FIR: Do not require specific phase for super-call receiver class

It's anyway defined in the outer context (outer class) that already
should have proper context
This commit is contained in:
Denis Zharkov
2020-08-26 16:15:05 +03:00
parent fcc2abcf40
commit 517056e0c6
2 changed files with 4 additions and 5 deletions
@@ -195,7 +195,7 @@ fun <T : FirResolvable> BodyResolveComponents.typeFromCallee(access: T): FirReso
else implicitReceiverStack.lastDispatchReceiver()
val resolvedTypeRef =
newCallee.superTypeRef as? FirResolvedTypeRef
?: implicitReceiver?.boundSymbol?.phasedFir?.superTypeRefs?.singleOrNull() as? FirResolvedTypeRef
?: implicitReceiver?.boundSymbol?.fir?.superTypeRefs?.singleOrNull() as? FirResolvedTypeRef
resolvedTypeRef ?: buildErrorTypeRef {
source = newCallee.source
diagnostic = ConeUnresolvedNameError(Name.identifier("super"))
@@ -24,7 +24,6 @@ import org.jetbrains.kotlin.fir.resolve.*
import org.jetbrains.kotlin.fir.resolve.calls.*
import org.jetbrains.kotlin.fir.resolve.diagnostics.*
import org.jetbrains.kotlin.fir.resolve.inference.FirStubInferenceSession
import org.jetbrains.kotlin.fir.resolve.toSymbol
import org.jetbrains.kotlin.fir.resolve.transformers.InvocationKindTransformer
import org.jetbrains.kotlin.fir.resolve.transformers.StoreReceiver
import org.jetbrains.kotlin.fir.resolve.transformers.firClassLike
@@ -160,7 +159,7 @@ open class FirExpressionsResolveTransformer(transformer: FirBodyResolveTransform
val actualSuperType = (superReference.superTypeRef.coneType as? ConeClassLikeType)
?.fullyExpandedType(session)?.let { superType ->
val classId = superType.lookupTag.classId
val superTypeRefs = implicitReceiver?.boundSymbol?.phasedFir?.superTypeRefs
val superTypeRefs = implicitReceiver?.boundSymbol?.fir?.superTypeRefs
val correspondingDeclaredSuperType = superTypeRefs?.firstOrNull {
it.coneType.fullyExpandedType(session).classId == classId
}?.coneTypeSafe<ConeClassLikeType>()?.fullyExpandedType(session) ?: return@let superType
@@ -190,7 +189,7 @@ open class FirExpressionsResolveTransformer(transformer: FirBodyResolveTransform
superReferenceContainer.resultType = actualSuperTypeRef
}
else -> {
val superTypeRefs = implicitReceiver?.boundSymbol?.phasedFir?.superTypeRefs
val superTypeRefs = implicitReceiver?.boundSymbol?.fir?.superTypeRefs
val resultType = when {
superTypeRefs?.isNotEmpty() != true || containingCall == null -> {
buildErrorTypeRef {
@@ -656,7 +655,7 @@ open class FirExpressionsResolveTransformer(transformer: FirBodyResolveTransform
lhs.typeArguments.map { it.toConeTypeProjection() }.toTypedArray()
} else {
// Otherwise, prepare the star projections as many as the size of type parameters.
Array((symbol?.phasedFir as? FirTypeParameterRefsOwner)?.typeParameters?.size ?: 0) {
Array((symbol?.fir as? FirTypeParameterRefsOwner)?.typeParameters?.size ?: 0) {
ConeStarProjection
}
}