JVM IR: Generate SAM wrapper classes as non-synthetic

This commit is contained in:
Steven Schäfer
2020-10-28 13:18:13 +01:00
committed by Alexander Udalov
parent 36711a768b
commit ec1d42e92b
5 changed files with 39 additions and 1 deletions
@@ -4338,6 +4338,11 @@ public class FirBytecodeTextTestGenerated extends AbstractFirBytecodeTextTest {
public void testSamWrapperOfReference() throws Exception {
runTest("compiler/testData/codegen/bytecodeText/sam/samWrapperOfReference.kt");
}
@TestMetadata("samWrapperSyntheticFlags.kt")
public void testSamWrapperSyntheticFlags() throws Exception {
runTest("compiler/testData/codegen/bytecodeText/sam/samWrapperSyntheticFlags.kt");
}
}
@TestMetadata("compiler/testData/codegen/bytecodeText/statements")
@@ -68,7 +68,7 @@ interface IrDeclarationOrigin {
object ADAPTER_FOR_SUSPEND_CONVERSION : IrDeclarationOriginImpl("ADAPTER_FOR_SUSPEND_CONVERSION")
object ADAPTER_PARAMETER_FOR_SUSPEND_CONVERSION : IrDeclarationOriginImpl("ADAPTER_PARAMETER_FOR_SUSPEND_CONVERSION")
object GENERATED_SAM_IMPLEMENTATION : IrDeclarationOriginImpl("GENERATED_SAM_IMPLEMENTATION", isSynthetic = true)
object GENERATED_SAM_IMPLEMENTATION : IrDeclarationOriginImpl("GENERATED_SAM_IMPLEMENTATION")
val isSynthetic: Boolean get() = false
}
@@ -0,0 +1,23 @@
// FILE: J.java
public class J {
public static void g(Runnable r) {
r.run();
}
}
// FILE: test.kt
fun nonInlineFun() {
val f = {}
J.g(f)
}
inline fun inlineFun() {
val f = {}
J.g(f)
}
// 1 final class TestKt\$sam\$java_lang_Runnable\$0 implements java/lang/Runnable
// 0 public final class TestKt\$sam\$java_lang_Runnable\$0 implements java/lang/Runnable
// 1 public final class TestKt\$sam\$i\$java_lang_Runnable\$0 implements java/lang/Runnable
@@ -4410,6 +4410,11 @@ public class BytecodeTextTestGenerated extends AbstractBytecodeTextTest {
public void testSamWrapperOfReference() throws Exception {
runTest("compiler/testData/codegen/bytecodeText/sam/samWrapperOfReference.kt");
}
@TestMetadata("samWrapperSyntheticFlags.kt")
public void testSamWrapperSyntheticFlags() throws Exception {
runTest("compiler/testData/codegen/bytecodeText/sam/samWrapperSyntheticFlags.kt");
}
}
@TestMetadata("compiler/testData/codegen/bytecodeText/statements")
@@ -4338,6 +4338,11 @@ public class IrBytecodeTextTestGenerated extends AbstractIrBytecodeTextTest {
public void testSamWrapperOfReference() throws Exception {
runTest("compiler/testData/codegen/bytecodeText/sam/samWrapperOfReference.kt");
}
@TestMetadata("samWrapperSyntheticFlags.kt")
public void testSamWrapperSyntheticFlags() throws Exception {
runTest("compiler/testData/codegen/bytecodeText/sam/samWrapperSyntheticFlags.kt");
}
}
@TestMetadata("compiler/testData/codegen/bytecodeText/statements")