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) { return when (this) {
is ConeCapturedType -> constructor is ConeCapturedType -> constructor
is ConeTypeVariableType -> this.lookupTag as ConeTypeVariableTypeConstructor // TODO: WTF 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}") is ConeLookupTagBasedType -> this.lookupTag.toSymbol(session) ?: ErrorTypeConstructor("Unresolved: ${this.lookupTag}")
else -> error("?: ${this}") else -> error("?: ${this}")
} }
@@ -341,9 +343,9 @@ interface ConeTypeContext : TypeSystemContext, TypeSystemOptimizationContext {
if (this is ConeCapturedType) return true if (this is ConeCapturedType) return true
if (this is ConeTypeVariableType) return false if (this is ConeTypeVariableType) return false
require(this is ConeLookupTagBasedType) require(this is ConeLookupTagBasedType)
val symbol = this.lookupTag.toSymbol(session) val typeConstructor = this.typeConstructor()
return symbol is FirClassSymbol || return typeConstructor is FirClassSymbol ||
symbol is FirTypeParameterSymbol typeConstructor is FirTypeParameterSymbol
} }
override fun captureFromExpression(type: KotlinTypeMarker): KotlinTypeMarker? { override fun captureFromExpression(type: KotlinTypeMarker): KotlinTypeMarker? {