JVM: enable -Xlambdas=class in some codegen tests

Most of these tests check the specific structure of lambdas when they
are generated as classes, and they start to fail once invokedynamic
lambdas are enabled by default.
This commit is contained in:
Alexander Udalov
2023-04-24 18:59:00 +02:00
committed by Space Team
parent 163afc94bc
commit cd9209a7ee
48 changed files with 55 additions and 81 deletions
+1
View File
@@ -1,5 +1,6 @@
// TARGET_BACKEND: JVM
// IGNORE_BACKEND: JVM
// LAMBDAS: CLASS
// WITH_STDLIB
class ShouldBeCaptured
+1 -1
View File
@@ -1,5 +1,5 @@
// TARGET_BACKEND: JVM
// LAMBDAS: CLASS
// WITH_STDLIB
class A {
@@ -1,4 +1,5 @@
// TARGET_BACKEND: JVM
// WITH_STDLIB
import java.io.*
@@ -13,7 +14,7 @@ fun box(): String {
var c = '1'
var z = true
val lambda = fun(): String {
val lambda = @JvmSerializableLambda fun(): String {
o = "OK"
b++; d++; f++; i++; j++; s++; c++
z = false
@@ -1,9 +1,5 @@
// IGNORE_BACKEND: WASM
// WASM_MUTE_REASON: IGNORED_IN_JS
// IGNORE_BACKEND: JS_IR
// IGNORE_BACKEND: JS_IR_ES6
// TODO: muted automatically, investigate should it be ran for JS or not
// IGNORE_BACKEND: JS, NATIVE
// TARGET_BACKEND: JVM
// LAMBDAS: CLASS
fun check(expected: String, obj: Any?) {
val actual = obj.toString()
@@ -3,6 +3,7 @@
// IGNORE_BACKEND: ANDROID
// JVM_TARGET: 1.8
// WITH_STDLIB
// LAMBDAS: CLASS
interface Z {
private fun privateFun() = { "OK" }
+2
View File
@@ -1,6 +1,8 @@
// TARGET_BACKEND: JVM
// JVM_TARGET: 1.8
// WITH_STDLIB
// LAMBDAS: CLASS
package test
interface Z {
@@ -1,5 +1,5 @@
// TARGET_BACKEND: JVM
// LAMBDAS: CLASS
// WITH_REFLECT
fun box(): String {
@@ -1,4 +1,5 @@
// TARGET_BACKEND: JVM
// LAMBDAS: CLASS
// has declaring class on Android 4.4
// IGNORE_BACKEND: ANDROID
@@ -1,5 +1,7 @@
// WITH_STDLIB
// TARGET_BACKEND: JVM
// LAMBDAS: CLASS
package test
interface Z {
@@ -1,5 +1,5 @@
// TARGET_BACKEND: JVM
// LAMBDAS: CLASS
// WITH_REFLECT
import java.util.HashMap
@@ -1,8 +1,9 @@
// TARGET_BACKEND: JVM
// LAMBDAS: CLASS
// SAM_CONVERSIONS: CLASS
// ^ SAM-convertion classes created with LambdaMetafactory have 'enclosingMethod' and 'enclosingClass'
// ^ Lambdas generated by LambdaMetafactory do not have 'enclosingMethod' or 'enclosingClass'
// WITH_REFLECT
package test
var lambda = {}
@@ -1,4 +1,5 @@
// TARGET_BACKEND: JVM
// LAMBDAS: CLASS
// has declaring class on Android 4.4
// IGNORE_BACKEND: ANDROID
@@ -1,6 +1,7 @@
// TARGET_BACKEND: JVM
// LAMBDAS: CLASS
// WITH_REFLECT
package test
class C {
@@ -1,5 +1,5 @@
// TARGET_BACKEND: JVM
// LAMBDAS: CLASS
// WITH_REFLECT
fun box(): String {
@@ -1,5 +1,5 @@
// TARGET_BACKEND: JVM
// LAMBDAS: CLASS
// WITH_REFLECT
fun box(): String {
@@ -1,4 +1,5 @@
// TARGET_BACKEND: JVM
// LAMBDAS: CLASS
// WITH_REFLECT
open class C
@@ -1,5 +1,5 @@
// TARGET_BACKEND: JVM
// LAMBDAS: CLASS
// WITH_REFLECT
open class C(val a: Any)
@@ -1,5 +1,5 @@
// TARGET_BACKEND: JVM
// LAMBDAS: CLASS
// WITH_REFLECT
// WITH_HELPERS
@@ -1,6 +1,7 @@
// TARGET_BACKEND: JVM
// LAMBDAS: CLASS
// WITH_REFLECT
package test
class C {
@@ -1,5 +1,5 @@
// TARGET_BACKEND: JVM
// LAMBDAS: CLASS
// WITH_REFLECT
fun box(): String {
@@ -1,5 +1,5 @@
// TARGET_BACKEND: JVM
// LAMBDAS: CLASS
// WITH_REFLECT
class C {
@@ -1,4 +1,5 @@
// TARGET_BACKEND: JVM
// LAMBDAS: CLASS
// has declaring class on Android 4.4
// IGNORE_BACKEND: ANDROID
@@ -1,4 +1,5 @@
// TARGET_BACKEND: JVM
// LAMBDAS: CLASS
// WITH_REFLECT
interface C {
@@ -1,5 +1,5 @@
// TARGET_BACKEND: JVM
// LAMBDAS: CLASS
// WITH_REFLECT
open class C(val a: Any)
@@ -1,4 +1,5 @@
// TARGET_BACKEND: JVM
// LAMBDAS: CLASS
// has declaring class on Android 4.4
// IGNORE_BACKEND: ANDROID
@@ -1,5 +1,7 @@
// TARGET_BACKEND: JVM
// LAMBDAS: CLASS
// WITH_STDLIB
package test
class C {
@@ -1,5 +1,5 @@
// TARGET_BACKEND: JVM
// LAMBDAS: CLASS
// WITH_REFLECT
val l: Any
@@ -1,5 +1,5 @@
// TARGET_BACKEND: JVM
// LAMBDAS: CLASS
// WITH_REFLECT
var _l: Any = ""
@@ -1,5 +1,5 @@
// TARGET_BACKEND: JVM
// LAMBDAS: CLASS
// WITH_REFLECT
fun box(): String {
@@ -1,4 +1,5 @@
// TARGET_BACKEND: JVM
// LAMBDAS: CLASS
import java.util.Date
@@ -1,6 +1,7 @@
// TARGET_BACKEND: JVM
// NO_CHECK_LAMBDA_INLINING
// WITH_REFLECT
// LAMBDAS: CLASS
// FILE: 1.kt
package test
@@ -1,6 +1,7 @@
// WITH_REFLECT
// FULL_JDK
// NO_CHECK_LAMBDA_INLINING
// LAMBDAS: CLASS
// TARGET_BACKEND: JVM
// FILE: 1.kt
package test
@@ -1,4 +1,5 @@
// !LANGUAGE: +ProperVisibilityForCompanionObjectInstanceField
// LAMBDAS: CLASS
class Host {
private companion object {
@@ -8,4 +9,4 @@ class Host {
fun test() = { foo() }
}
// 1 synthetic access\$
// 1 synthetic access\$
@@ -1,5 +1,5 @@
// !LANGUAGE: +ProperVisibilityForCompanionObjectInstanceField
// LAMBDAS: CLASS
// FILE: Base.kt
package a
@@ -17,4 +17,4 @@ class Host : Base() {
}
// @Host.class:
// 1 synthetic access\$
// 1 synthetic access\$
@@ -1,3 +1,5 @@
// LAMBDAS: CLASS
fun test() {
fun local(){
@@ -1,3 +1,5 @@
// LAMBDAS: CLASS
fun test() {
{
val lam = {}
+2
View File
@@ -1,3 +1,5 @@
// LAMBDAS: CLASS
fun box(): String {
var encl1 = "fail"
var encl2 = "fail"
+3 -1
View File
@@ -1,3 +1,5 @@
// LAMBDAS: CLASS
class A {
public var prop = "O"
private set
@@ -9,4 +11,4 @@ class A {
}
// 0 INVOKESTATIC test\/A\.access\$getProp\$0
// 1 INVOKEVIRTUAL A\.getProp
// 1 INVOKEVIRTUAL A\.getProp
@@ -1,3 +1,4 @@
// LAMBDAS: CLASS
// FILE: test.kt
// This should *not* have enclosing method <clinit>. See https://youtrack.jetbrains.com/issue/KT-48754.
@@ -14001,12 +14001,6 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
runTest("compiler/testData/codegen/box/functions/functionNtoStringGeneric.kt");
}
@Test
@TestMetadata("functionNtoStringNoReflect.kt")
public void testFunctionNtoStringNoReflect() throws Exception {
runTest("compiler/testData/codegen/box/functions/functionNtoStringNoReflect.kt");
}
@Test
@TestMetadata("infixRecursiveCall.kt")
public void testInfixRecursiveCall() throws Exception {
@@ -14097,12 +14097,6 @@ public class FirJsCodegenBoxTestGenerated extends AbstractFirJsCodegenBoxTest {
runTest("compiler/testData/codegen/box/functions/functionNtoStringGeneric.kt");
}
@Test
@TestMetadata("functionNtoStringNoReflect.kt")
public void testFunctionNtoStringNoReflect() throws Exception {
runTest("compiler/testData/codegen/box/functions/functionNtoStringNoReflect.kt");
}
@Test
@TestMetadata("infixRecursiveCall.kt")
public void testInfixRecursiveCall() throws Exception {
@@ -14097,12 +14097,6 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
runTest("compiler/testData/codegen/box/functions/functionNtoStringGeneric.kt");
}
@Test
@TestMetadata("functionNtoStringNoReflect.kt")
public void testFunctionNtoStringNoReflect() throws Exception {
runTest("compiler/testData/codegen/box/functions/functionNtoStringNoReflect.kt");
}
@Test
@TestMetadata("infixRecursiveCall.kt")
public void testInfixRecursiveCall() throws Exception {
@@ -14097,12 +14097,6 @@ public class IrJsES6CodegenBoxTestGenerated extends AbstractIrJsES6CodegenBoxTes
runTest("compiler/testData/codegen/box/functions/functionNtoStringGeneric.kt");
}
@Test
@TestMetadata("functionNtoStringNoReflect.kt")
public void testFunctionNtoStringNoReflect() throws Exception {
runTest("compiler/testData/codegen/box/functions/functionNtoStringNoReflect.kt");
}
@Test
@TestMetadata("infixRecursiveCall.kt")
public void testInfixRecursiveCall() throws Exception {
@@ -15482,12 +15482,6 @@ public class FirNativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTe
runTest("compiler/testData/codegen/box/functions/functionNtoStringGeneric.kt");
}
@Test
@TestMetadata("functionNtoStringNoReflect.kt")
public void testFunctionNtoStringNoReflect() throws Exception {
runTest("compiler/testData/codegen/box/functions/functionNtoStringNoReflect.kt");
}
@Test
@TestMetadata("infixRecursiveCall.kt")
public void testInfixRecursiveCall() throws Exception {
@@ -15844,12 +15844,6 @@ public class FirNativeCodegenBoxTestNoPLGenerated extends AbstractNativeCodegenB
runTest("compiler/testData/codegen/box/functions/functionNtoStringGeneric.kt");
}
@Test
@TestMetadata("functionNtoStringNoReflect.kt")
public void testFunctionNtoStringNoReflect() throws Exception {
runTest("compiler/testData/codegen/box/functions/functionNtoStringNoReflect.kt");
}
@Test
@TestMetadata("infixRecursiveCall.kt")
public void testInfixRecursiveCall() throws Exception {
@@ -15301,12 +15301,6 @@ public class NativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTest
runTest("compiler/testData/codegen/box/functions/functionNtoStringGeneric.kt");
}
@Test
@TestMetadata("functionNtoStringNoReflect.kt")
public void testFunctionNtoStringNoReflect() throws Exception {
runTest("compiler/testData/codegen/box/functions/functionNtoStringNoReflect.kt");
}
@Test
@TestMetadata("infixRecursiveCall.kt")
public void testInfixRecursiveCall() throws Exception {
@@ -15663,12 +15663,6 @@ public class NativeCodegenBoxTestNoPLGenerated extends AbstractNativeCodegenBoxT
runTest("compiler/testData/codegen/box/functions/functionNtoStringGeneric.kt");
}
@Test
@TestMetadata("functionNtoStringNoReflect.kt")
public void testFunctionNtoStringNoReflect() throws Exception {
runTest("compiler/testData/codegen/box/functions/functionNtoStringNoReflect.kt");
}
@Test
@TestMetadata("infixRecursiveCall.kt")
public void testInfixRecursiveCall() throws Exception {
@@ -12516,11 +12516,6 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest
runTest("compiler/testData/codegen/box/functions/functionNtoStringGeneric.kt");
}
@TestMetadata("functionNtoStringNoReflect.kt")
public void testFunctionNtoStringNoReflect() throws Exception {
runTest("compiler/testData/codegen/box/functions/functionNtoStringNoReflect.kt");
}
@TestMetadata("infixRecursiveCall.kt")
public void testInfixRecursiveCall() throws Exception {
runTest("compiler/testData/codegen/box/functions/infixRecursiveCall.kt");