FIR: introduce workaround to avoid type-aliases in ConeClassType

This commit is contained in:
Simon Ogorodnik
2019-04-30 17:02:09 +03:00
committed by Mikhail Glukhikh
parent c06d521e78
commit 2111e56d2e
@@ -127,7 +127,7 @@ interface ConeTypeContext : TypeSystemContext, TypeSystemOptimizationContext {
} }
override fun SimpleTypeMarker.typeConstructor(): TypeConstructorMarker { override fun SimpleTypeMarker.typeConstructor(): TypeConstructorMarker {
return when (this) { val typeConstructor = 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() is ConeAbbreviatedType -> this.directExpansionType(session)?.typeConstructor()
@@ -136,6 +136,12 @@ interface ConeTypeContext : TypeSystemContext, TypeSystemOptimizationContext {
else -> error("?: ${this}") else -> error("?: ${this}")
} }
// TODO: get rid of class types with type-alias symbols
if (typeConstructor is FirTypeAliasSymbol) {
return typeConstructor.fir.expandedTypeRef.coneTypeSafe()?.typeConstructor()
?: ErrorTypeConstructor("Failed to expand alias: ${this}")
}
return typeConstructor
} }
override fun SimpleTypeMarker.argumentsCount(): Int { override fun SimpleTypeMarker.argumentsCount(): Int {