kotlinp: use JVM_IR backend for compiling tests

Also, test optimized delegated properties.
This commit is contained in:
pyos
2021-07-02 11:09:42 +02:00
committed by Alexander Udalov
parent 791fa411d8
commit 2fe7cf27ad
4 changed files with 9 additions and 7 deletions
@@ -13,6 +13,7 @@ import org.jetbrains.kotlin.checkers.setupLanguageVersionSettingsForCompilerTest
import org.jetbrains.kotlin.cli.jvm.compiler.EnvironmentConfigFiles
import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment
import org.jetbrains.kotlin.codegen.GenerationUtils
import org.jetbrains.kotlin.config.JVMConfigurationKeys
import org.jetbrains.kotlin.jvm.compiler.AbstractLoadJavaTest
import org.jetbrains.kotlin.kotlinp.Kotlinp
import org.jetbrains.kotlin.kotlinp.KotlinpSettings
@@ -74,6 +75,7 @@ fun compileAndPrintAllFiles(file: File, disposable: Disposable, tmpdir: File, co
private fun compile(file: File, disposable: Disposable, tmpdir: File, forEachOutputFile: (File) -> Unit) {
val content = file.readText()
val configuration = KotlinTestUtils.newConfiguration(ConfigurationKind.ALL, TestJdkKind.MOCK_JDK)
configuration.put(JVMConfigurationKeys.IR, true)
AbstractLoadJavaTest.updateConfigurationWithDirectives(content, configuration)
val environment = KotlinCoreEnvironment.createForTests(disposable, configuration, EnvironmentConfigFiles.JVM_CONFIG_FILES)
setupLanguageVersionSettingsForCompilerTests(content, environment)
@@ -22,13 +22,6 @@ public final class Class : kotlin/Any {
// module name: test-module
}
// Class$f$1.class
// ------------------------------------------
lambda {
// signature: invoke()V
local final fun g(): kotlin/Unit
}
// Delegate.class
// ------------------------------------------
public final class Delegate<T#0 /* T */> : kotlin/Any {
+2
View File
@@ -8,5 +8,7 @@ class C(val constructorParam: String = "") {
val <T : Number> T.delegated: List<Nothing> by null
val withOptimizedDelegate by C::getterOnlyVal
operator fun Nothing?.getValue(x: Any?, y: Any?) = emptyList<Nothing>()
}
+5
View File
@@ -30,6 +30,11 @@ public final class C : kotlin/Any {
public final get
public final set
// getter: getWithOptimizedDelegate()D
// synthetic method for delegate: getWithOptimizedDelegate$delegate(LC;)Ljava/lang/Object;
public final /* delegated */ val withOptimizedDelegate: kotlin/Double
public final /* non-default */ get
// field: delegated$delegate:Ljava/lang/Void;
// getter: getDelegated(Ljava/lang/Number;)Ljava/util/List;
public final /* delegated */ val <T#0 /* T */ : kotlin/Number> T#0.delegated: kotlin/collections/List<kotlin/Nothing>