JVM: enable -Xlambdas=class for some backend tests
These tests are checking the specifics of the class-generated lambdas.
This commit is contained in:
committed by
Space Team
parent
834ba397ad
commit
d757847ed6
@@ -1,3 +1,5 @@
|
|||||||
|
// LAMBDAS: CLASS
|
||||||
|
|
||||||
data class A(val x: String, val y: Int)
|
data class A(val x: String, val y: Int)
|
||||||
|
|
||||||
fun foo(a: A, block: (A) -> String): String = block(a)
|
fun foo(a: A, block: (A) -> String): String = block(a)
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
// LAMBDAS: CLASS
|
||||||
|
|
||||||
public fun <T> Iterable<T>.myforEach(operation: (T) -> Unit) : Unit {
|
public fun <T> Iterable<T>.myforEach(operation: (T) -> Unit) : Unit {
|
||||||
for (element in this) operation(element)
|
for (element in this) operation(element)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
// LAMBDAS: CLASS
|
||||||
|
|
||||||
fun foo() {
|
fun foo() {
|
||||||
fun bar() : (Int) -> Unit {
|
fun bar() : (Int) -> Unit {
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
// LAMBDAS: CLASS
|
||||||
|
|
||||||
fun foo() {
|
fun foo() {
|
||||||
var a = {
|
var a = {
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
// LAMBDAS: CLASS
|
||||||
|
|
||||||
operator fun (() -> String).getValue(thisRef: Any?, property: Any?) = this()
|
operator fun (() -> String).getValue(thisRef: Any?, property: Any?) = this()
|
||||||
|
|
||||||
fun foo() {
|
fun foo() {
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
// LAMBDAS: CLASS
|
||||||
|
|
||||||
data class A(val x: Double = 1.0, val y: String = "", val z: Char = '0')
|
data class A(val x: Double = 1.0, val y: String = "", val z: Char = '0')
|
||||||
|
|
||||||
fun foo(a: A, block: (A, String, Int) -> String): String = block(a, "", 1)
|
fun foo(a: A, block: (A, String, Int) -> String): String = block(a, "", 1)
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
$TESTDATA_DIR$/syntheticAccessorForPropertiesSignatureClash.kt
|
$TESTDATA_DIR$/syntheticAccessorForPropertiesSignatureClash.kt
|
||||||
-d
|
-d
|
||||||
$TEMP_DIR$
|
$TEMP_DIR$
|
||||||
|
-Xlambdas=class
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
$TESTDATA_DIR$/syntheticAccessorPropertyAndFunSignatureClash.kt
|
$TESTDATA_DIR$/syntheticAccessorPropertyAndFunSignatureClash.kt
|
||||||
-d
|
-d
|
||||||
$TEMP_DIR$
|
$TEMP_DIR$
|
||||||
|
-Xlambdas=class
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
// IGNORE_BACKEND: ANDROID
|
// IGNORE_BACKEND: ANDROID
|
||||||
// JVM_TARGET: 1.8
|
// JVM_TARGET: 1.8
|
||||||
// WITH_STDLIB
|
// WITH_STDLIB
|
||||||
|
// LAMBDAS: CLASS
|
||||||
|
|
||||||
interface Z {
|
interface Z {
|
||||||
private fun privateFun() = { "OK" }
|
private fun privateFun() = { "OK" }
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
// LAMBDAS: CLASS
|
||||||
|
|
||||||
class Foo {
|
class Foo {
|
||||||
fun foo() = { }
|
fun foo() = { }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// LAMBDAS: CLASS
|
||||||
// IGNORE_BACKEND_K2: JVM_IR
|
// IGNORE_BACKEND_K2: JVM_IR
|
||||||
// TARGET_BACKEND: JVM
|
// TARGET_BACKEND: JVM
|
||||||
// FILE: Base.java
|
// FILE: Base.java
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
// LAMBDAS: CLASS
|
||||||
|
|
||||||
class MyList<T> {
|
class MyList<T> {
|
||||||
|
|
||||||
private fun noSignature(): T? = null
|
private fun noSignature(): T? = null
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import org.jetbrains.kotlin.checkers.ENABLE_JVM_PREVIEW
|
|||||||
import org.jetbrains.kotlin.checkers.parseLanguageVersionSettings
|
import org.jetbrains.kotlin.checkers.parseLanguageVersionSettings
|
||||||
import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment
|
import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment
|
||||||
import org.jetbrains.kotlin.config.*
|
import org.jetbrains.kotlin.config.*
|
||||||
import org.jetbrains.kotlin.config.JvmTarget.Companion.fromString
|
|
||||||
import org.jetbrains.kotlin.test.testFramework.KtUsefulTestCase
|
import org.jetbrains.kotlin.test.testFramework.KtUsefulTestCase
|
||||||
import org.jetbrains.kotlin.test.util.KtTestUtil
|
import org.jetbrains.kotlin.test.util.KtTestUtil
|
||||||
import java.io.File
|
import java.io.File
|
||||||
@@ -147,7 +146,7 @@ abstract class KotlinBaseTest<F : KotlinBaseTest.TestFile> : KtUsefulTestCase()
|
|||||||
}
|
}
|
||||||
val targetString = directives["JVM_TARGET"]
|
val targetString = directives["JVM_TARGET"]
|
||||||
if (targetString != null) {
|
if (targetString != null) {
|
||||||
val jvmTarget = fromString(targetString)
|
val jvmTarget = JvmTarget.fromString(targetString)
|
||||||
?: error("Unknown target: $targetString")
|
?: error("Unknown target: $targetString")
|
||||||
configuration.put(JVMConfigurationKeys.JVM_TARGET, jvmTarget)
|
configuration.put(JVMConfigurationKeys.JVM_TARGET, jvmTarget)
|
||||||
}
|
}
|
||||||
@@ -173,6 +172,13 @@ abstract class KotlinBaseTest<F : KotlinBaseTest.TestFile> : KtUsefulTestCase()
|
|||||||
assert(explicitLanguageVersionSettings == null) { "Should not specify !LANGUAGE directive twice" }
|
assert(explicitLanguageVersionSettings == null) { "Should not specify !LANGUAGE directive twice" }
|
||||||
explicitLanguageVersionSettings = fileLanguageVersionSettings
|
explicitLanguageVersionSettings = fileLanguageVersionSettings
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val lambdasString = directives["LAMBDAS"]
|
||||||
|
if (lambdasString != null) {
|
||||||
|
val lambdas = JvmClosureGenerationScheme.fromString(lambdasString)
|
||||||
|
?: error("Unknown lambdas mode: $lambdasString")
|
||||||
|
configuration.put(JVMConfigurationKeys.LAMBDAS, lambdas)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (explicitLanguageVersionSettings != null) {
|
if (explicitLanguageVersionSettings != null) {
|
||||||
configuration.languageVersionSettings = explicitLanguageVersionSettings
|
configuration.languageVersionSettings = explicitLanguageVersionSettings
|
||||||
|
|||||||
+1
@@ -1,4 +1,5 @@
|
|||||||
// WITH_STDLIB
|
// WITH_STDLIB
|
||||||
|
// LAMBDAS: CLASS
|
||||||
|
|
||||||
@file:JvmName("TestKt")
|
@file:JvmName("TestKt")
|
||||||
package test
|
package test
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
// WITH_STDLIB
|
// WITH_STDLIB
|
||||||
|
// LAMBDAS: CLASS
|
||||||
|
|
||||||
@file:JvmName("TestKt")
|
@file:JvmName("TestKt")
|
||||||
package test
|
package test
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
// See KT-44891, https://issuetracker.google.com/180193969
|
// See KT-44891, https://issuetracker.google.com/180193969
|
||||||
// WITH_STDLIB
|
// WITH_STDLIB
|
||||||
|
// LAMBDAS: CLASS
|
||||||
|
|
||||||
@file:JvmName("TestKt")
|
@file:JvmName("TestKt")
|
||||||
package test
|
package test
|
||||||
|
|||||||
Reference in New Issue
Block a user