K2: Fix type-alias expansion during suspend function type serialization
When suspend function type is serialized, there is special logic that adds Continuation parameter, before doing so, type-aliases has to be expanded, attributes for resulting type should also derive from expanded type KT-53193, KT-54062
This commit is contained in:
+5
@@ -1000,6 +1000,11 @@ public class FirLoadCompiledKotlinGenerated extends AbstractFirLoadCompiledKotli
|
||||
public void testBasic() throws Exception {
|
||||
runTest("compiler/testData/loadJava/compiledKotlin/coroutines/Basic.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("TypeAliasFTSuspendWithReceiver.kt")
|
||||
public void testTypeAliasFTSuspendWithReceiver() throws Exception {
|
||||
runTest("compiler/testData/loadJava/compiledKotlin/coroutines/TypeAliasFTSuspendWithReceiver.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/loadJava/compiledKotlin/dataClass")
|
||||
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
public final fun foo(f: R|suspend test/Context.() -> kotlin/Unit|): R|kotlin/Unit|
|
||||
|
||||
public final class Context : R|kotlin/Any| {
|
||||
public constructor(): R|test/Context|
|
||||
|
||||
}
|
||||
|
||||
public final typealias SuspendWithContext = R|suspend test/Context.() -> kotlin/Unit|
|
||||
|
||||
@@ -123,7 +123,7 @@ fun ConeKotlinType.suspendFunctionTypeToFunctionTypeWithContinuation(session: Fi
|
||||
isNullable = false
|
||||
) + lastTypeArgument).toTypedArray(),
|
||||
isNullable = false,
|
||||
attributes = attributes
|
||||
attributes = fullyExpandedType.attributes
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
// NO_CHECK_SOURCE_VS_BINARY
|
||||
// Type-alias info is lost during serialization in K1
|
||||
package test
|
||||
|
||||
class Context
|
||||
|
||||
typealias SuspendWithContext = suspend Context.() -> Unit
|
||||
|
||||
fun foo(f: SuspendWithContext) {}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
package test
|
||||
|
||||
public fun foo(/*0*/ f: suspend test.Context.() -> kotlin.Unit): kotlin.Unit
|
||||
|
||||
public final class Context {
|
||||
/*primary*/ public constructor Context()
|
||||
}
|
||||
public typealias SuspendWithContext = suspend test.Context.() -> kotlin.Unit
|
||||
+5
@@ -2678,6 +2678,11 @@ public class LoadJavaTestGenerated extends AbstractLoadJavaTest {
|
||||
public void testBasic() throws Exception {
|
||||
runTest("compiler/testData/loadJava/compiledKotlin/coroutines/Basic.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("TypeAliasFTSuspendWithReceiver.kt")
|
||||
public void testTypeAliasFTSuspendWithReceiver() throws Exception {
|
||||
runTest("compiler/testData/loadJava/compiledKotlin/coroutines/TypeAliasFTSuspendWithReceiver.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/loadJava/compiledKotlin/dataClass")
|
||||
|
||||
Generated
+5
@@ -1000,6 +1000,11 @@ public class LoadKotlinWithTypeTableTestGenerated extends AbstractLoadKotlinWith
|
||||
public void testBasic() throws Exception {
|
||||
runTest("compiler/testData/loadJava/compiledKotlin/coroutines/Basic.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("TypeAliasFTSuspendWithReceiver.kt")
|
||||
public void testTypeAliasFTSuspendWithReceiver() throws Exception {
|
||||
runTest("compiler/testData/loadJava/compiledKotlin/coroutines/TypeAliasFTSuspendWithReceiver.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/loadJava/compiledKotlin/dataClass")
|
||||
|
||||
+5
@@ -2679,6 +2679,11 @@ public class IrLoadJavaTestGenerated extends AbstractIrLoadJavaTest {
|
||||
public void testBasic() throws Exception {
|
||||
runTest("compiler/testData/loadJava/compiledKotlin/coroutines/Basic.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("TypeAliasFTSuspendWithReceiver.kt")
|
||||
public void testTypeAliasFTSuspendWithReceiver() throws Exception {
|
||||
runTest("compiler/testData/loadJava/compiledKotlin/coroutines/TypeAliasFTSuspendWithReceiver.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/loadJava/compiledKotlin/dataClass")
|
||||
|
||||
Generated
+5
@@ -2678,6 +2678,11 @@ public class LoadJavaUsingJavacTestGenerated extends AbstractLoadJavaUsingJavacT
|
||||
public void testBasic() throws Exception {
|
||||
runTest("compiler/testData/loadJava/compiledKotlin/coroutines/Basic.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("TypeAliasFTSuspendWithReceiver.kt")
|
||||
public void testTypeAliasFTSuspendWithReceiver() throws Exception {
|
||||
runTest("compiler/testData/loadJava/compiledKotlin/coroutines/TypeAliasFTSuspendWithReceiver.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/loadJava/compiledKotlin/dataClass")
|
||||
|
||||
+5
@@ -1002,6 +1002,11 @@ public class JvmRuntimeDescriptorLoaderTestGenerated extends AbstractJvmRuntimeD
|
||||
public void testBasic() throws Exception {
|
||||
runTest("compiler/testData/loadJava/compiledKotlin/coroutines/Basic.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("TypeAliasFTSuspendWithReceiver.kt")
|
||||
public void testTypeAliasFTSuspendWithReceiver() throws Exception {
|
||||
runTest("compiler/testData/loadJava/compiledKotlin/coroutines/TypeAliasFTSuspendWithReceiver.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/loadJava/compiledKotlin/dataClass")
|
||||
|
||||
Reference in New Issue
Block a user