Expand type-aliases in cone (FIR) type context

This commit is contained in:
Simon Ogorodnik
2019-04-23 04:18:04 +03:00
committed by Mikhail Glukhikh
parent 6f9f9fc087
commit ee73d21d32
@@ -130,6 +130,8 @@ interface ConeTypeContext : TypeSystemContext, TypeSystemOptimizationContext {
return when (this) {
is ConeCapturedType -> constructor
is ConeTypeVariableType -> this.lookupTag as ConeTypeVariableTypeConstructor // TODO: WTF
is ConeAbbreviatedType -> this.directExpansionType(session)?.typeConstructor()
?: ErrorTypeConstructor("Failed to expand alias: ${this}")
is ConeLookupTagBasedType -> this.lookupTag.toSymbol(session) ?: ErrorTypeConstructor("Unresolved: ${this.lookupTag}")
else -> error("?: ${this}")
}
@@ -341,9 +343,9 @@ interface ConeTypeContext : TypeSystemContext, TypeSystemOptimizationContext {
if (this is ConeCapturedType) return true
if (this is ConeTypeVariableType) return false
require(this is ConeLookupTagBasedType)
val symbol = this.lookupTag.toSymbol(session)
return symbol is FirClassSymbol ||
symbol is FirTypeParameterSymbol
val typeConstructor = this.typeConstructor()
return typeConstructor is FirClassSymbol ||
typeConstructor is FirTypeParameterSymbol
}
override fun captureFromExpression(type: KotlinTypeMarker): KotlinTypeMarker? {