[FIR] Fix CCE in deserialization of suspend function type with star projection continuation

#KT-64148 Fixed
This commit is contained in:
Kirill Rakhman
2023-12-13 11:21:15 +01:00
committed by Space Team
parent 01976990e8
commit 6d1ca3d379
21 changed files with 156 additions and 1 deletions
@@ -11216,6 +11216,12 @@ public class LLFirBlackBoxCodegenBasedTestGenerated extends AbstractLLFirBlackBo
runTest("compiler/testData/codegen/box/coroutines/delegatedSuspendMember.kt");
}
@Test
@TestMetadata("deserializedSuspendFunctionProperty.kt")
public void testDeserializedSuspendFunctionProperty() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/deserializedSuspendFunctionProperty.kt");
}
@Test
@TestMetadata("dispatchResume.kt")
public void testDispatchResume() throws Exception {
@@ -11216,6 +11216,12 @@ public class LLFirReversedBlackBoxCodegenBasedTestGenerated extends AbstractLLFi
runTest("compiler/testData/codegen/box/coroutines/delegatedSuspendMember.kt");
}
@Test
@TestMetadata("deserializedSuspendFunctionProperty.kt")
public void testDeserializedSuspendFunctionProperty() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/deserializedSuspendFunctionProperty.kt");
}
@Test
@TestMetadata("dispatchResume.kt")
public void testDispatchResume() throws Exception {
@@ -221,7 +221,7 @@ class FirTypeDeserializer(
val continuationType = arguments.getOrNull(arguments.lastIndex - 1) as? ConeClassLikeType ?: return null
if (!continuationType.isContinuation()) return ConeClassLikeTypeImpl(functionTypeConstructor, arguments, isNullable, attributes)
val suspendReturnType = continuationType.typeArguments.single() as ConeKotlinTypeProjection
val suspendReturnType = continuationType.typeArguments.single()
val valueParameters = arguments.dropLast(2)
val kind = FunctionTypeKind.SuspendFunction
@@ -11157,6 +11157,12 @@ public class FirLightTreeBlackBoxCodegenTestGenerated extends AbstractFirLightTr
runTest("compiler/testData/codegen/box/coroutines/delegatedSuspendMember.kt");
}
@Test
@TestMetadata("deserializedSuspendFunctionProperty.kt")
public void testDeserializedSuspendFunctionProperty() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/deserializedSuspendFunctionProperty.kt");
}
@Test
@TestMetadata("dispatchResume.kt")
public void testDispatchResume() throws Exception {
@@ -11157,6 +11157,12 @@ public class FirLightTreeBlackBoxCodegenWithIrFakeOverrideGeneratorTestGenerated
runTest("compiler/testData/codegen/box/coroutines/delegatedSuspendMember.kt");
}
@Test
@TestMetadata("deserializedSuspendFunctionProperty.kt")
public void testDeserializedSuspendFunctionProperty() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/deserializedSuspendFunctionProperty.kt");
}
@Test
@TestMetadata("dispatchResume.kt")
public void testDispatchResume() throws Exception {
@@ -11157,6 +11157,12 @@ public class FirPsiBlackBoxCodegenTestGenerated extends AbstractFirPsiBlackBoxCo
runTest("compiler/testData/codegen/box/coroutines/delegatedSuspendMember.kt");
}
@Test
@TestMetadata("deserializedSuspendFunctionProperty.kt")
public void testDeserializedSuspendFunctionProperty() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/deserializedSuspendFunctionProperty.kt");
}
@Test
@TestMetadata("dispatchResume.kt")
public void testDispatchResume() throws Exception {
@@ -0,0 +1,42 @@
// WITH_STDLIB
// WITH_COROUTINES
// IGNORE_BACKEND_K1: JVM, JS_IR, JS_IR_ES6, WASM, NATIVE
// ^Reports FUN_INTERFACE_WITH_SUSPEND_FUNCTION on K1 JVM (non-IR) and fails in backend on others
// MODULE: m1
// FILE: m1.kt
typealias GivenLambda<ParentGivenType, GivenType> =
suspend GivenDSL<ParentGivenType>.() -> GivenType
fun interface GivenDSL<ParentGivenType> {
suspend fun given(): ParentGivenType
}
class GivenDSLHandler(
val lambda: GivenLambda<*, *> = {},
) {
suspend fun run(dsl: GivenDSL<*>): Any? {
return dsl.lambda()
}
}
// MODULE: m2(m1)
// FILE: box.kt
import helpers.*
import kotlin.coroutines.*
fun builder(c: suspend () -> Unit) {
c.startCoroutine(EmptyContinuation)
}
fun box(): String {
var result = "FAIL"
builder {
GivenDSLHandler(
lambda = { result = this.given() as String; null },
).run { "OK" }
}
return result
}
@@ -10869,6 +10869,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
runTest("compiler/testData/codegen/box/coroutines/delegatedSuspendMember.kt");
}
@Test
@TestMetadata("deserializedSuspendFunctionProperty.kt")
public void testDeserializedSuspendFunctionProperty() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/deserializedSuspendFunctionProperty.kt");
}
@Test
@TestMetadata("dispatchResume.kt")
public void testDispatchResume() throws Exception {
@@ -11157,6 +11157,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
runTest("compiler/testData/codegen/box/coroutines/delegatedSuspendMember.kt");
}
@Test
@TestMetadata("deserializedSuspendFunctionProperty.kt")
public void testDeserializedSuspendFunctionProperty() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/deserializedSuspendFunctionProperty.kt");
}
@Test
@TestMetadata("dispatchResume.kt")
public void testDispatchResume() throws Exception {
@@ -11157,6 +11157,12 @@ public class IrBlackBoxCodegenWithIrInlinerTestGenerated extends AbstractIrBlack
runTest("compiler/testData/codegen/box/coroutines/delegatedSuspendMember.kt");
}
@Test
@TestMetadata("deserializedSuspendFunctionProperty.kt")
public void testDeserializedSuspendFunctionProperty() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/deserializedSuspendFunctionProperty.kt");
}
@Test
@TestMetadata("dispatchResume.kt")
public void testDispatchResume() throws Exception {
@@ -8874,6 +8874,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
runTest("compiler/testData/codegen/box/coroutines/delegatedSuspendMember.kt");
}
@TestMetadata("deserializedSuspendFunctionProperty.kt")
public void testDeserializedSuspendFunctionProperty() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/deserializedSuspendFunctionProperty.kt");
}
@TestMetadata("dispatchResume.kt")
public void testDispatchResume() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/dispatchResume.kt");
@@ -7905,6 +7905,12 @@ public class FirJsCodegenBoxTestGenerated extends AbstractFirJsCodegenBoxTest {
runTest("compiler/testData/codegen/box/coroutines/delegatedSuspendMember.kt");
}
@Test
@TestMetadata("deserializedSuspendFunctionProperty.kt")
public void testDeserializedSuspendFunctionProperty() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/deserializedSuspendFunctionProperty.kt");
}
@Test
@TestMetadata("dispatchResume.kt")
public void testDispatchResume() throws Exception {
@@ -7905,6 +7905,12 @@ public class FirJsES6CodegenBoxTestGenerated extends AbstractFirJsES6CodegenBoxT
runTest("compiler/testData/codegen/box/coroutines/delegatedSuspendMember.kt");
}
@Test
@TestMetadata("deserializedSuspendFunctionProperty.kt")
public void testDeserializedSuspendFunctionProperty() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/deserializedSuspendFunctionProperty.kt");
}
@Test
@TestMetadata("dispatchResume.kt")
public void testDispatchResume() throws Exception {
@@ -7905,6 +7905,12 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
runTest("compiler/testData/codegen/box/coroutines/delegatedSuspendMember.kt");
}
@Test
@TestMetadata("deserializedSuspendFunctionProperty.kt")
public void testDeserializedSuspendFunctionProperty() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/deserializedSuspendFunctionProperty.kt");
}
@Test
@TestMetadata("dispatchResume.kt")
public void testDispatchResume() throws Exception {
@@ -7905,6 +7905,12 @@ public class IrJsES6CodegenBoxTestGenerated extends AbstractIrJsES6CodegenBoxTes
runTest("compiler/testData/codegen/box/coroutines/delegatedSuspendMember.kt");
}
@Test
@TestMetadata("deserializedSuspendFunctionProperty.kt")
public void testDeserializedSuspendFunctionProperty() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/deserializedSuspendFunctionProperty.kt");
}
@Test
@TestMetadata("dispatchResume.kt")
public void testDispatchResume() throws Exception {
@@ -8780,6 +8780,12 @@ public class FirNativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTe
runTest("compiler/testData/codegen/box/coroutines/delegatedSuspendMember.kt");
}
@Test
@TestMetadata("deserializedSuspendFunctionProperty.kt")
public void testDeserializedSuspendFunctionProperty() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/deserializedSuspendFunctionProperty.kt");
}
@Test
@TestMetadata("dispatchResume.kt")
public void testDispatchResume() throws Exception {
@@ -8974,6 +8974,12 @@ public class FirNativeCodegenBoxTestNoPLGenerated extends AbstractNativeCodegenB
runTest("compiler/testData/codegen/box/coroutines/delegatedSuspendMember.kt");
}
@Test
@TestMetadata("deserializedSuspendFunctionProperty.kt")
public void testDeserializedSuspendFunctionProperty() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/deserializedSuspendFunctionProperty.kt");
}
@Test
@TestMetadata("dispatchResume.kt")
public void testDispatchResume() throws Exception {
@@ -8586,6 +8586,12 @@ public class NativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTest
runTest("compiler/testData/codegen/box/coroutines/delegatedSuspendMember.kt");
}
@Test
@TestMetadata("deserializedSuspendFunctionProperty.kt")
public void testDeserializedSuspendFunctionProperty() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/deserializedSuspendFunctionProperty.kt");
}
@Test
@TestMetadata("dispatchResume.kt")
public void testDispatchResume() throws Exception {
@@ -8781,6 +8781,12 @@ public class NativeCodegenBoxTestNoPLGenerated extends AbstractNativeCodegenBoxT
runTest("compiler/testData/codegen/box/coroutines/delegatedSuspendMember.kt");
}
@Test
@TestMetadata("deserializedSuspendFunctionProperty.kt")
public void testDeserializedSuspendFunctionProperty() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/deserializedSuspendFunctionProperty.kt");
}
@Test
@TestMetadata("dispatchResume.kt")
public void testDispatchResume() throws Exception {
@@ -7881,6 +7881,12 @@ public class FirWasmCodegenBoxTestGenerated extends AbstractFirWasmCodegenBoxTes
runTest("compiler/testData/codegen/box/coroutines/delegatedSuspendMember.kt");
}
@Test
@TestMetadata("deserializedSuspendFunctionProperty.kt")
public void testDeserializedSuspendFunctionProperty() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/deserializedSuspendFunctionProperty.kt");
}
@Test
@TestMetadata("dispatchResume.kt")
public void testDispatchResume() throws Exception {
@@ -7881,6 +7881,12 @@ public class K1WasmCodegenBoxTestGenerated extends AbstractK1WasmCodegenBoxTest
runTest("compiler/testData/codegen/box/coroutines/delegatedSuspendMember.kt");
}
@Test
@TestMetadata("deserializedSuspendFunctionProperty.kt")
public void testDeserializedSuspendFunctionProperty() throws Exception {
runTest("compiler/testData/codegen/box/coroutines/deserializedSuspendFunctionProperty.kt");
}
@Test
@TestMetadata("dispatchResume.kt")
public void testDispatchResume() throws Exception {