FIR: serialize both expanded and abbreviated type to metadata

This commit is contained in:
pyos
2022-10-17 15:04:24 +02:00
committed by teamcity
parent a939f9ccd0
commit 1fcf099104
2 changed files with 20 additions and 2 deletions
@@ -627,6 +627,26 @@ class FirElementSerializer private constructor(
toSuper: Boolean = false,
correspondingTypeRef: FirTypeRef? = null,
isDefinitelyNotNullType: Boolean = false,
): ProtoBuf.Type.Builder {
val typeProto = typeOrTypealiasProto(type, toSuper, correspondingTypeRef, isDefinitelyNotNullType)
val expanded = if (type is ConeClassLikeType) type.fullyExpandedType(session) else type
if (expanded === type) {
return typeProto
}
val expandedProto = typeOrTypealiasProto(expanded, toSuper, correspondingTypeRef, isDefinitelyNotNullType)
if (useTypeTable()) {
expandedProto.abbreviatedTypeId = typeTable[typeProto]
} else {
expandedProto.setAbbreviatedType(typeProto)
}
return expandedProto
}
private fun typeOrTypealiasProto(
type: ConeKotlinType,
toSuper: Boolean,
correspondingTypeRef: FirTypeRef?,
isDefinitelyNotNullType: Boolean,
): ProtoBuf.Type.Builder {
val builder = ProtoBuf.Type.newBuilder()
when (type) {
@@ -1,5 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// FIR status: List is empty for val argumentType = mycType.arguments.single().type!!
// TARGET_BACKEND: JVM
// WITH_REFLECT
// MODULE: lib