JVM IR: generate adapted callable references as synthetic
As well as suspend conversion adapters, which are unsupported by default right now. #KT-46259 Fixed
This commit is contained in:
committed by
TeamCityServer
parent
d60a8f9baa
commit
6e3009b82e
@@ -65,9 +65,9 @@ interface IrDeclarationOrigin {
|
||||
object FIELD_FOR_ENUM_VALUES : IrDeclarationOriginImpl("FIELD_FOR_ENUM_VALUES", isSynthetic = true)
|
||||
object FIELD_FOR_OBJECT_INSTANCE : IrDeclarationOriginImpl("FIELD_FOR_OBJECT_INSTANCE")
|
||||
|
||||
object ADAPTER_FOR_CALLABLE_REFERENCE : IrDeclarationOriginImpl("ADAPTER_FOR_CALLABLE_REFERENCE")
|
||||
object ADAPTER_FOR_CALLABLE_REFERENCE : IrDeclarationOriginImpl("ADAPTER_FOR_CALLABLE_REFERENCE", isSynthetic = true)
|
||||
object ADAPTER_PARAMETER_FOR_CALLABLE_REFERENCE : IrDeclarationOriginImpl("ADAPTER_PARAMETER_FOR_CALLABLE_REFERENCE")
|
||||
object ADAPTER_FOR_SUSPEND_CONVERSION : IrDeclarationOriginImpl("ADAPTER_FOR_SUSPEND_CONVERSION")
|
||||
object ADAPTER_FOR_SUSPEND_CONVERSION : IrDeclarationOriginImpl("ADAPTER_FOR_SUSPEND_CONVERSION", isSynthetic = true)
|
||||
object ADAPTER_PARAMETER_FOR_SUSPEND_CONVERSION : IrDeclarationOriginImpl("ADAPTER_PARAMETER_FOR_SUSPEND_CONVERSION")
|
||||
|
||||
object GENERATED_SAM_IMPLEMENTATION : IrDeclarationOriginImpl("GENERATED_SAM_IMPLEMENTATION")
|
||||
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
class A {
|
||||
private fun defaultArgs(value: Int = 0, message: String = "hello"): String = message
|
||||
|
||||
private fun myApply(f: () -> String) {}
|
||||
private fun myApplySuspend(f: suspend () -> String) {}
|
||||
|
||||
fun testDefaultArguments() {
|
||||
myApply(::defaultArgs)
|
||||
myApplySuspend(::defaultArgs)
|
||||
}
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
@kotlin.Metadata
|
||||
synthetic final class A$testDefaultArguments$1 {
|
||||
// source: 'adaptedReference.kt'
|
||||
enclosing method A.testDefaultArguments()V
|
||||
inner (anonymous) class A$testDefaultArguments$1
|
||||
method <init>(p0: A): void
|
||||
public synthetic bridge method invoke(): java.lang.Object
|
||||
public final @org.jetbrains.annotations.NotNull method invoke(): java.lang.String
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
synthetic final class A$testDefaultArguments$2 {
|
||||
// source: 'adaptedReference.kt'
|
||||
enclosing method A.testDefaultArguments()V
|
||||
inner (anonymous) class A$testDefaultArguments$2
|
||||
method <init>(p0: A): void
|
||||
public final @org.jetbrains.annotations.Nullable method invoke(@org.jetbrains.annotations.Nullable p0: java.lang.Object): java.lang.Object
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class A {
|
||||
// source: 'adaptedReference.kt'
|
||||
inner (anonymous) class A$testDefaultArguments$1
|
||||
inner (anonymous) class A$testDefaultArguments$2
|
||||
public method <init>(): void
|
||||
synthetic static method defaultArgs$default(p0: A, p1: int, p2: java.lang.String, p3: int, p4: java.lang.Object): java.lang.String
|
||||
private final method defaultArgs(p0: int, p1: java.lang.String): java.lang.String
|
||||
private final method myApply(p0: kotlin.jvm.functions.Function0): void
|
||||
private final method myApplySuspend(p0: kotlin.jvm.functions.Function1): void
|
||||
public final method testDefaultArguments(): void
|
||||
}
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
@kotlin.Metadata
|
||||
synthetic final class A$testDefaultArguments$1 {
|
||||
// source: 'adaptedReference.kt'
|
||||
enclosing method A.testDefaultArguments()V
|
||||
inner (anonymous) class A$testDefaultArguments$1
|
||||
method <init>(p0: A): void
|
||||
public synthetic final static method access$getReceiver$p(p0: A$testDefaultArguments$1): java.lang.Object
|
||||
public synthetic bridge method invoke(): java.lang.Object
|
||||
public final @org.jetbrains.annotations.NotNull method invoke(): java.lang.String
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
synthetic final class A$testDefaultArguments$2 {
|
||||
// source: 'adaptedReference.kt'
|
||||
enclosing method A.testDefaultArguments()V
|
||||
inner (anonymous) class A$testDefaultArguments$2
|
||||
method <init>(p0: A): void
|
||||
public synthetic final static method access$getReceiver$p(p0: A$testDefaultArguments$2): java.lang.Object
|
||||
public final @org.jetbrains.annotations.Nullable method invoke(@org.jetbrains.annotations.NotNull p0: kotlin.coroutines.Continuation): java.lang.Object
|
||||
public synthetic bridge method invoke(p0: java.lang.Object): java.lang.Object
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class A {
|
||||
// source: 'adaptedReference.kt'
|
||||
inner (anonymous) class A$testDefaultArguments$1
|
||||
inner (anonymous) class A$testDefaultArguments$2
|
||||
public method <init>(): void
|
||||
public synthetic final static method access$testDefaultArguments$defaultArgs(p0: A): java.lang.String
|
||||
public synthetic final static method access$testDefaultArguments$defaultArgs-0(p0: A, p1: kotlin.coroutines.Continuation): java.lang.Object
|
||||
synthetic static method defaultArgs$default(p0: A, p1: int, p2: java.lang.String, p3: int, p4: java.lang.Object): java.lang.String
|
||||
private final method defaultArgs(p0: int, p1: java.lang.String): java.lang.String
|
||||
private final method myApply(p0: kotlin.jvm.functions.Function0): void
|
||||
private final method myApplySuspend(p0: kotlin.jvm.functions.Function1): void
|
||||
private synthetic final static method testDefaultArguments$defaultArgs(p0: A): java.lang.String
|
||||
private synthetic final static method testDefaultArguments$defaultArgs-0(p0: A, p1: kotlin.coroutines.Continuation): java.lang.Object
|
||||
public final method testDefaultArguments(): void
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// !LANGUAGE: +SuspendConversion
|
||||
|
||||
fun myApply(f: suspend () -> Unit) {}
|
||||
|
||||
fun test(f: () -> Unit) {
|
||||
myApply(f)
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
@kotlin.Metadata
|
||||
public final class SuspendConversionKt {
|
||||
// source: 'suspendConversion.kt'
|
||||
public final static method myApply(@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function1): void
|
||||
public final static method test(@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function0): void
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
@kotlin.Metadata
|
||||
synthetic final class SuspendConversionKt$test$1 {
|
||||
// source: 'suspendConversion.kt'
|
||||
enclosing method SuspendConversionKt.test(Lkotlin/jvm/functions/Function0;)V
|
||||
inner (anonymous) class SuspendConversionKt$test$1
|
||||
method <init>(p0: kotlin.jvm.functions.Function0): void
|
||||
public final @org.jetbrains.annotations.Nullable method invoke(@org.jetbrains.annotations.NotNull p0: kotlin.coroutines.Continuation): java.lang.Object
|
||||
public synthetic bridge method invoke(p0: java.lang.Object): java.lang.Object
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class SuspendConversionKt {
|
||||
// source: 'suspendConversion.kt'
|
||||
inner (anonymous) class SuspendConversionKt$test$1
|
||||
public synthetic final static method access$test$suspendConversion0(p0: kotlin.jvm.functions.Function0, p1: kotlin.coroutines.Continuation): java.lang.Object
|
||||
public final static method myApply(@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function1): void
|
||||
private synthetic final static method test$suspendConversion0(p0: kotlin.jvm.functions.Function0, p1: kotlin.coroutines.Continuation): java.lang.Object
|
||||
public final static method test(@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function0): void
|
||||
}
|
||||
+22
@@ -407,6 +407,22 @@ public class BytecodeListingTestGenerated extends AbstractBytecodeListingTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/bytecodeListing/callableReference")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class CallableReference {
|
||||
@Test
|
||||
@TestMetadata("adaptedReference.kt")
|
||||
public void testAdaptedReference() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeListing/callableReference/adaptedReference.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAllFilesPresentInCallableReference() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeListing/callableReference"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/bytecodeListing/collectionStubs")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@@ -860,6 +876,12 @@ public class BytecodeListingTestGenerated extends AbstractBytecodeListingTest {
|
||||
runTest("compiler/testData/codegen/bytecodeListing/coroutines/privateSuspendFun.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("suspendConversion.kt")
|
||||
public void testSuspendConversion() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeListing/coroutines/suspendConversion.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("suspendImpl.kt")
|
||||
public void testSuspendImpl() throws Exception {
|
||||
|
||||
+22
@@ -407,6 +407,22 @@ public class IrBytecodeListingTestGenerated extends AbstractIrBytecodeListingTes
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/bytecodeListing/callableReference")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class CallableReference {
|
||||
@Test
|
||||
@TestMetadata("adaptedReference.kt")
|
||||
public void testAdaptedReference() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeListing/callableReference/adaptedReference.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAllFilesPresentInCallableReference() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeListing/callableReference"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/codegen/bytecodeListing/collectionStubs")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@@ -860,6 +876,12 @@ public class IrBytecodeListingTestGenerated extends AbstractIrBytecodeListingTes
|
||||
runTest("compiler/testData/codegen/bytecodeListing/coroutines/privateSuspendFun.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("suspendConversion.kt")
|
||||
public void testSuspendConversion() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeListing/coroutines/suspendConversion.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("suspendImpl.kt")
|
||||
public void testSuspendImpl() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user