Add serialization/deserialization of definitely-not-null types

^KT-26245 In Progress
This commit is contained in:
Denis.Zharkov
2021-04-06 17:42:56 +03:00
committed by TeamCityServer
parent 6ca6bb2d45
commit 30eb9ad32f
19 changed files with 98 additions and 11 deletions
@@ -132,9 +132,16 @@ class FirTypeDeserializer(
fun FirClassLikeSymbol<*>.typeParameters(): List<FirTypeParameterSymbol> =
(fir as? FirTypeParameterRefsOwner)?.typeParameters?.map { it.symbol }.orEmpty()
fun simpleType(proto: ProtoBuf.Type, attributes: ConeAttributes): ConeLookupTagBasedType? {
fun simpleType(proto: ProtoBuf.Type, attributes: ConeAttributes): ConeSimpleKotlinType? {
val constructor = typeSymbol(proto) ?: return null
if (constructor is ConeTypeParameterLookupTag) return ConeTypeParameterTypeImpl(constructor, isNullable = proto.nullable)
if (constructor is ConeTypeParameterLookupTag) {
return ConeTypeParameterTypeImpl(constructor, isNullable = proto.nullable).let {
if (Flags.DEFINITELY_NOT_NULL_TYPE.get(proto.flags))
ConeDefinitelyNotNullType.create(it)
else
it
}
}
if (constructor !is ConeClassLikeLookupTag) return null
fun ProtoBuf.Type.collectAllArguments(): List<ProtoBuf.Type.Argument> =