FIR: serialize both expanded and abbreviated type to metadata
This commit is contained in:
+20
@@ -627,6 +627,26 @@ class FirElementSerializer private constructor(
|
|||||||
toSuper: Boolean = false,
|
toSuper: Boolean = false,
|
||||||
correspondingTypeRef: FirTypeRef? = null,
|
correspondingTypeRef: FirTypeRef? = null,
|
||||||
isDefinitelyNotNullType: Boolean = false,
|
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 {
|
): ProtoBuf.Type.Builder {
|
||||||
val builder = ProtoBuf.Type.newBuilder()
|
val builder = ProtoBuf.Type.newBuilder()
|
||||||
when (type) {
|
when (type) {
|
||||||
|
|||||||
-2
@@ -1,5 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// FIR status: List is empty for val argumentType = mycType.arguments.single().type!!
|
|
||||||
// TARGET_BACKEND: JVM
|
// TARGET_BACKEND: JVM
|
||||||
// WITH_REFLECT
|
// WITH_REFLECT
|
||||||
// MODULE: lib
|
// MODULE: lib
|
||||||
|
|||||||
Reference in New Issue
Block a user