FIR: provide resolved super-type as the type of enum entry reference

This commit is contained in:
Simon Ogorodnik
2019-04-25 14:23:41 +03:00
committed by Mikhail Glukhikh
parent 8e200d8113
commit adf845b2fd
@@ -166,10 +166,19 @@ open class FirBodyResolveTransformer(val session: FirSession, val implicitTypeOn
if (symbol is ConeCallableSymbol) {
jump.tryCalculateReturnType(symbol.firUnsafe())
} else if (symbol is ConeClassifierSymbol) {
FirResolvedTypeRefImpl(
session, null, symbol.constructType(emptyArray(), isNullable = false),
isMarkedNullable = false, annotations = emptyList()
)
val firUnsafe = symbol.firUnsafe()
// TODO: unhack
if (firUnsafe is FirEnumEntry) {
(firUnsafe.superTypeRefs.firstOrNull() as? FirResolvedTypeRef) ?: FirErrorTypeRefImpl(
session,
null,
"no enum item supertype"
)
} else
FirResolvedTypeRefImpl(
session, null, symbol.constructType(emptyArray(), isNullable = false),
isMarkedNullable = false, annotations = emptyList()
)
} else {
error("WTF ! $symbol")
}