[FIR2IR] Fix incorrect type of typealias for suspend functional type, ^KT-50997 Fixed
This commit is contained in:
+6
@@ -44593,6 +44593,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
||||
runTest("compiler/testData/codegen/box/typealias/genericTypeAliasConstructor2.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("incorrectTypeOfTypealiasForSuspendFunctionalType.kt")
|
||||
public void testIncorrectTypeOfTypealiasForSuspendFunctionalType() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/typealias/incorrectTypeOfTypealiasForSuspendFunctionalType.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("innerClassTypeAliasConstructor.kt")
|
||||
public void testInnerClassTypeAliasConstructor() throws Exception {
|
||||
|
||||
@@ -107,12 +107,15 @@ fun ConeKotlinType.suspendFunctionTypeToFunctionTypeWithContinuation(session: Fi
|
||||
if (isKFunctionType(session)) FunctionClassKind.KFunction
|
||||
else FunctionClassKind.Function
|
||||
val functionalTypeId = ClassId(kind.packageFqName, kind.numberedClassName(typeArguments.size))
|
||||
val fullyExpandedType = type.fullyExpandedType(session)
|
||||
val typeArguments = fullyExpandedType.typeArguments
|
||||
val lastTypeArgument = typeArguments.last()
|
||||
return ConeClassLikeTypeImpl(
|
||||
ConeClassLikeLookupTagImpl(functionalTypeId),
|
||||
typeArguments = (type.typeArguments.dropLast(1) + ConeClassLikeLookupTagImpl(continuationClassId).constructClassType(
|
||||
arrayOf(type.typeArguments.last()),
|
||||
typeArguments = (typeArguments.dropLast(1) + ConeClassLikeLookupTagImpl(continuationClassId).constructClassType(
|
||||
arrayOf(lastTypeArgument),
|
||||
isNullable = false
|
||||
) + type.typeArguments.last()).toTypedArray(),
|
||||
) + lastTypeArgument).toTypedArray(),
|
||||
isNullable = false,
|
||||
attributes = attributes
|
||||
)
|
||||
|
||||
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
// ISSUE: KT-50997
|
||||
|
||||
typealias MySuspendFunction = suspend (String) -> Unit
|
||||
fun foo(function: MySuspendFunction) {}
|
||||
fun box() = "OK"
|
||||
+6
@@ -44101,6 +44101,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
runTest("compiler/testData/codegen/box/typealias/genericTypeAliasConstructor2.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("incorrectTypeOfTypealiasForSuspendFunctionalType.kt")
|
||||
public void testIncorrectTypeOfTypealiasForSuspendFunctionalType() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/typealias/incorrectTypeOfTypealiasForSuspendFunctionalType.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("innerClassTypeAliasConstructor.kt")
|
||||
public void testInnerClassTypeAliasConstructor() throws Exception {
|
||||
|
||||
+6
@@ -44593,6 +44593,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
runTest("compiler/testData/codegen/box/typealias/genericTypeAliasConstructor2.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("incorrectTypeOfTypealiasForSuspendFunctionalType.kt")
|
||||
public void testIncorrectTypeOfTypealiasForSuspendFunctionalType() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/typealias/incorrectTypeOfTypealiasForSuspendFunctionalType.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("innerClassTypeAliasConstructor.kt")
|
||||
public void testInnerClassTypeAliasConstructor() throws Exception {
|
||||
|
||||
+5
@@ -35737,6 +35737,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
||||
runTest("compiler/testData/codegen/box/typealias/genericTypeAliasConstructor2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("incorrectTypeOfTypealiasForSuspendFunctionalType.kt")
|
||||
public void testIncorrectTypeOfTypealiasForSuspendFunctionalType() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/typealias/incorrectTypeOfTypealiasForSuspendFunctionalType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("innerClassTypeAliasConstructor.kt")
|
||||
public void testInnerClassTypeAliasConstructor() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/typealias/innerClassTypeAliasConstructor.kt");
|
||||
|
||||
+6
@@ -31851,6 +31851,12 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
||||
runTest("compiler/testData/codegen/box/typealias/genericTypeAliasConstructor2.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("incorrectTypeOfTypealiasForSuspendFunctionalType.kt")
|
||||
public void testIncorrectTypeOfTypealiasForSuspendFunctionalType() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/typealias/incorrectTypeOfTypealiasForSuspendFunctionalType.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("innerClassTypeAliasConstructor.kt")
|
||||
public void testInnerClassTypeAliasConstructor() throws Exception {
|
||||
|
||||
+6
@@ -31953,6 +31953,12 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
|
||||
runTest("compiler/testData/codegen/box/typealias/genericTypeAliasConstructor2.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("incorrectTypeOfTypealiasForSuspendFunctionalType.kt")
|
||||
public void testIncorrectTypeOfTypealiasForSuspendFunctionalType() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/typealias/incorrectTypeOfTypealiasForSuspendFunctionalType.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("innerClassTypeAliasConstructor.kt")
|
||||
public void testInnerClassTypeAliasConstructor() throws Exception {
|
||||
|
||||
+5
@@ -26719,6 +26719,11 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest
|
||||
runTest("compiler/testData/codegen/box/typealias/genericTypeAliasConstructor2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("incorrectTypeOfTypealiasForSuspendFunctionalType.kt")
|
||||
public void testIncorrectTypeOfTypealiasForSuspendFunctionalType() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/typealias/incorrectTypeOfTypealiasForSuspendFunctionalType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("innerClassTypeAliasConstructor.kt")
|
||||
public void testInnerClassTypeAliasConstructor() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/typealias/innerClassTypeAliasConstructor.kt");
|
||||
|
||||
Generated
+6
@@ -34198,6 +34198,12 @@ public class ExternalTestGenerated extends AbstractExternalNativeBlackBoxTest {
|
||||
runTest("compiler/testData/codegen/box/typealias/genericTypeAliasConstructor2.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("incorrectTypeOfTypealiasForSuspendFunctionalType.kt")
|
||||
public void testIncorrectTypeOfTypealiasForSuspendFunctionalType() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/typealias/incorrectTypeOfTypealiasForSuspendFunctionalType.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("innerClassTypeAliasConstructor.kt")
|
||||
public void testInnerClassTypeAliasConstructor() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user