[FIR] Introduce ConeDynamicType

This commit is contained in:
Nikolay Lunyak
2021-12-17 18:09:54 +03:00
committed by teamcity
parent e763197c3e
commit be9e97d044
13 changed files with 66 additions and 63 deletions
@@ -115,7 +115,15 @@ class FirTypeDeserializer(
if (proto.hasFlexibleTypeCapabilitiesId()) {
val lowerBound = simpleType(proto, attributes)
val upperBound = simpleType(proto.flexibleUpperBound(typeTable)!!, attributes)
return ConeFlexibleType(lowerBound!!, upperBound!!)
val isDynamic = lowerBound == moduleData.session.builtinTypes.nothingType.coneType &&
upperBound == moduleData.session.builtinTypes.nullableAnyType.coneType
return if (isDynamic) {
ConeDynamicType.create(moduleData.session)
} else {
ConeFlexibleType(lowerBound!!, upperBound!!)
}
}
return simpleType(proto, attributes) ?: ConeErrorType(ConeSimpleDiagnostic("?!id:0", DiagnosticKind.DeserializationError))