[FIR2IR] Fix incorrect type of typealias for suspend functional type, ^KT-50997 Fixed

This commit is contained in:
Ivan Kochurkin
2022-01-28 20:01:40 +03:00
committed by teamcity
parent 828c442518
commit 5391ee91af
10 changed files with 57 additions and 3 deletions
@@ -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
)