JVM: prepare asmLike tests for indy lambdas by default

Use -Xlambdas=class in tests which were checking specific things related
to how anonymous classes for lambdas work (such as receiver mangling,
function arity etc.)
This commit is contained in:
Alexander Udalov
2023-04-20 15:10:20 +02:00
committed by Space Team
parent 4c4afbd646
commit 163afc94bc
20 changed files with 49 additions and 61 deletions
@@ -1,6 +1,7 @@
// !LANGUAGE: +NewCapturedReceiverFieldNamingConvention
// IR_DIFFERENCE
// LOCAL_VARIABLE_TABLE
// LAMBDAS: CLASS
fun String.foo(count: Int) {
val x = false
@@ -1,6 +1,7 @@
// !LANGUAGE: -NewCapturedReceiverFieldNamingConvention
// IR_DIFFERENCE
// LOCAL_VARIABLE_TABLE
// LAMBDAS: CLASS
fun String.foo(count: Int) {
val x = false
@@ -1,6 +1,7 @@
// !LANGUAGE: +NewCapturedReceiverFieldNamingConvention
// IR_DIFFERENCE
// LOCAL_VARIABLE_TABLE
// LAMBDAS: CLASS
fun String.foo(count: Int) {
val x = false
@@ -1,6 +1,7 @@
// !LANGUAGE: -NewCapturedReceiverFieldNamingConvention
// IR_DIFFERENCE
// LOCAL_VARIABLE_TABLE
// LAMBDAS: CLASS
fun String.foo(count: Int) {
val x = false
@@ -1,5 +1,6 @@
// IR_DIFFERENCE
// LOCAL_VARIABLE_TABLE
// LAMBDAS: CLASS
fun foo() {
t { (`a b`, `b$c`, `c-d`, `b$$c--d`, `a()§&*&^@あ化`) -> }
@@ -1,5 +1,6 @@
// IR_DIFFERENCE
// LOCAL_VARIABLE_TABLE
// LAMBDAS: CLASS
fun String.foo(count: Int) {
val x = false
@@ -1,6 +1,7 @@
// !LANGUAGE: -NewCapturedReceiverFieldNamingConvention
// IR_DIFFERENCE
// LOCAL_VARIABLE_TABLE
// LAMBDAS: CLASS
fun String.foo(count: Int) {
val x = false
@@ -12,6 +12,20 @@ final class foo/Kotlin$foo5$lambda$1 : kotlin/jvm/internal/Lambda, kotlin/jvm/fu
public java.lang.Object invoke()
}
Lkotlin/jvm/internal/Lambda;Lkotlin/jvm/functions/Function0<Ljava/lang/String;>;
final class foo/Kotlin$foo6$indyLambda$1 : kotlin/jvm/internal/Lambda, kotlin/jvm/functions/Function0 {
final foo.Kotlin this$0
void <init>(foo.Kotlin $receiver)
public final java.lang.String invoke()
@Lorg/jetbrains/annotations/NotNull;([]) // invisible
@Lfoo/TypeAnn;([name="2"]) : METHOD_RETURN, null
@Lfoo/TypeAnnBinary;([]) : METHOD_RETURN, null // invisible
public java.lang.Object invoke()
}
public final class foo/Kotlin : java/lang/Object {
public void <init>()
@@ -31,6 +45,8 @@ public final class foo/Kotlin : java/lang/Object {
@Lfoo/TypeAnnBinary;([]) : METHOD_RETURN, null // invisible
public final void foo5()
public final void foo6()
}
public abstract interface foo/TypeAnn : java/lang/Object, java/lang/annotation/Annotation {
@@ -26,6 +26,20 @@ final class foo/Kotlin$foo5$lambda$1 : kotlin/jvm/internal/Lambda, kotlin/jvm/fu
@Lfoo/TypeAnnBinary;([]) : METHOD_RETURN, null // invisible
}
Lkotlin/jvm/internal/Lambda;Lkotlin/jvm/functions/Function0<Ljava/lang/String;>;
final class foo/Kotlin$foo6$indyLambda$1 : kotlin/jvm/internal/Lambda, kotlin/jvm/functions/Function0 {
final foo.Kotlin this$0
void <init>(foo.Kotlin p0)
public java.lang.Object invoke()
public final java.lang.String invoke()
@Lorg/jetbrains/annotations/NotNull;([]) // invisible
@Lfoo/TypeAnn;([name="2"]) : METHOD_RETURN, null
@Lfoo/TypeAnnBinary;([]) : METHOD_RETURN, null // invisible
}
public final class foo/Kotlin : java/lang/Object {
public void <init>()
@@ -45,6 +59,8 @@ public final class foo/Kotlin : java/lang/Object {
@Lfoo/TypeAnnBinary;([]) : METHOD_RETURN, null // invisible
public final void foo5()
public final void foo6()
}
public abstract interface foo/TypeAnn : java/lang/Object, java/lang/annotation/Annotation {
@@ -3,6 +3,8 @@
// RENDER_ANNOTATIONS
// TARGET_BACKEND: JVM
// JVM_TARGET: 1.8
// WITH_STDLIB
package foo
@Target(AnnotationTarget.TYPE)
@@ -27,7 +29,12 @@ class Kotlin {
fun foo4() = { foo2() }()
fun foo5() {
val lambda = { foo2() }
val lambda = @JvmSerializableLambda { foo2() }
lambda()
}
fun foo6() {
val indyLambda = { foo2() }
indyLambda()
}
}
@@ -1,12 +1,7 @@
// 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
// IGNORE_LIGHT_ANALYSIS
// WITH_STDLIB
// LAMBDAS: CLASS
import kotlin.test.assertEquals
import kotlin.jvm.internal.FunctionBase
@@ -2814,12 +2814,6 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
runTest("compiler/testData/codegen/box/callableReference/function/genericWithDependentType.kt");
}
@Test
@TestMetadata("getArityViaFunctionImpl.kt")
public void testGetArityViaFunctionImpl() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/function/getArityViaFunctionImpl.kt");
}
@Test
@TestMetadata("innerClassConstructorWithTwoReceivers.kt")
public void testInnerClassConstructorWithTwoReceivers() throws Exception {
@@ -2868,12 +2868,6 @@ public class FirJsCodegenBoxTestGenerated extends AbstractFirJsCodegenBoxTest {
runTest("compiler/testData/codegen/box/callableReference/function/genericWithDependentType.kt");
}
@Test
@TestMetadata("getArityViaFunctionImpl.kt")
public void testGetArityViaFunctionImpl() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/function/getArityViaFunctionImpl.kt");
}
@Test
@TestMetadata("innerClassConstructorWithTwoReceivers.kt")
public void testInnerClassConstructorWithTwoReceivers() throws Exception {
@@ -2868,12 +2868,6 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
runTest("compiler/testData/codegen/box/callableReference/function/genericWithDependentType.kt");
}
@Test
@TestMetadata("getArityViaFunctionImpl.kt")
public void testGetArityViaFunctionImpl() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/function/getArityViaFunctionImpl.kt");
}
@Test
@TestMetadata("innerClassConstructorWithTwoReceivers.kt")
public void testInnerClassConstructorWithTwoReceivers() throws Exception {
@@ -2868,12 +2868,6 @@ public class IrJsES6CodegenBoxTestGenerated extends AbstractIrJsES6CodegenBoxTes
runTest("compiler/testData/codegen/box/callableReference/function/genericWithDependentType.kt");
}
@Test
@TestMetadata("getArityViaFunctionImpl.kt")
public void testGetArityViaFunctionImpl() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/function/getArityViaFunctionImpl.kt");
}
@Test
@TestMetadata("innerClassConstructorWithTwoReceivers.kt")
public void testInnerClassConstructorWithTwoReceivers() throws Exception {
@@ -3003,12 +3003,6 @@ public class FirNativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTe
runTest("compiler/testData/codegen/box/callableReference/function/genericWithDependentType.kt");
}
@Test
@TestMetadata("getArityViaFunctionImpl.kt")
public void testGetArityViaFunctionImpl() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/function/getArityViaFunctionImpl.kt");
}
@Test
@TestMetadata("innerClassConstructorWithTwoReceivers.kt")
public void testInnerClassConstructorWithTwoReceivers() throws Exception {
@@ -3073,12 +3073,6 @@ public class FirNativeCodegenBoxTestNoPLGenerated extends AbstractNativeCodegenB
runTest("compiler/testData/codegen/box/callableReference/function/genericWithDependentType.kt");
}
@Test
@TestMetadata("getArityViaFunctionImpl.kt")
public void testGetArityViaFunctionImpl() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/function/getArityViaFunctionImpl.kt");
}
@Test
@TestMetadata("innerClassConstructorWithTwoReceivers.kt")
public void testInnerClassConstructorWithTwoReceivers() throws Exception {
@@ -2968,12 +2968,6 @@ public class NativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTest
runTest("compiler/testData/codegen/box/callableReference/function/genericWithDependentType.kt");
}
@Test
@TestMetadata("getArityViaFunctionImpl.kt")
public void testGetArityViaFunctionImpl() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/function/getArityViaFunctionImpl.kt");
}
@Test
@TestMetadata("innerClassConstructorWithTwoReceivers.kt")
public void testInnerClassConstructorWithTwoReceivers() throws Exception {
@@ -3038,12 +3038,6 @@ public class NativeCodegenBoxTestNoPLGenerated extends AbstractNativeCodegenBoxT
runTest("compiler/testData/codegen/box/callableReference/function/genericWithDependentType.kt");
}
@Test
@TestMetadata("getArityViaFunctionImpl.kt")
public void testGetArityViaFunctionImpl() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/function/getArityViaFunctionImpl.kt");
}
@Test
@TestMetadata("innerClassConstructorWithTwoReceivers.kt")
public void testInnerClassConstructorWithTwoReceivers() throws Exception {
@@ -2543,11 +2543,6 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest
runTest("compiler/testData/codegen/box/callableReference/function/genericWithDependentType.kt");
}
@TestMetadata("getArityViaFunctionImpl.kt")
public void testGetArityViaFunctionImpl() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/function/getArityViaFunctionImpl.kt");
}
@TestMetadata("innerClassConstructorWithTwoReceivers.kt")
public void testInnerClassConstructorWithTwoReceivers() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/function/innerClassConstructorWithTwoReceivers.kt");