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:
@@ -195,7 +195,7 @@ fun <T : FirResolvable> BodyResolveComponents.typeFromCallee(access: T): FirReso
|
|||||||
else implicitReceiverStack.lastDispatchReceiver()
|
else implicitReceiverStack.lastDispatchReceiver()
|
||||||
val resolvedTypeRef =
|
val resolvedTypeRef =
|
||||||
newCallee.superTypeRef as? FirResolvedTypeRef
|
newCallee.superTypeRef as? FirResolvedTypeRef
|
||||||
?: implicitReceiver?.boundSymbol?.phasedFir?.superTypeRefs?.singleOrNull() as? FirResolvedTypeRef
|
?: implicitReceiver?.boundSymbol?.fir?.superTypeRefs?.singleOrNull() as? FirResolvedTypeRef
|
||||||
resolvedTypeRef ?: buildErrorTypeRef {
|
resolvedTypeRef ?: buildErrorTypeRef {
|
||||||
source = newCallee.source
|
source = newCallee.source
|
||||||
diagnostic = ConeUnresolvedNameError(Name.identifier("super"))
|
diagnostic = ConeUnresolvedNameError(Name.identifier("super"))
|
||||||
|
|||||||
+3
-4
@@ -24,7 +24,6 @@ import org.jetbrains.kotlin.fir.resolve.*
|
|||||||
import org.jetbrains.kotlin.fir.resolve.calls.*
|
import org.jetbrains.kotlin.fir.resolve.calls.*
|
||||||
import org.jetbrains.kotlin.fir.resolve.diagnostics.*
|
import org.jetbrains.kotlin.fir.resolve.diagnostics.*
|
||||||
import org.jetbrains.kotlin.fir.resolve.inference.FirStubInferenceSession
|
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.InvocationKindTransformer
|
||||||
import org.jetbrains.kotlin.fir.resolve.transformers.StoreReceiver
|
import org.jetbrains.kotlin.fir.resolve.transformers.StoreReceiver
|
||||||
import org.jetbrains.kotlin.fir.resolve.transformers.firClassLike
|
import org.jetbrains.kotlin.fir.resolve.transformers.firClassLike
|
||||||
@@ -160,7 +159,7 @@ open class FirExpressionsResolveTransformer(transformer: FirBodyResolveTransform
|
|||||||
val actualSuperType = (superReference.superTypeRef.coneType as? ConeClassLikeType)
|
val actualSuperType = (superReference.superTypeRef.coneType as? ConeClassLikeType)
|
||||||
?.fullyExpandedType(session)?.let { superType ->
|
?.fullyExpandedType(session)?.let { superType ->
|
||||||
val classId = superType.lookupTag.classId
|
val classId = superType.lookupTag.classId
|
||||||
val superTypeRefs = implicitReceiver?.boundSymbol?.phasedFir?.superTypeRefs
|
val superTypeRefs = implicitReceiver?.boundSymbol?.fir?.superTypeRefs
|
||||||
val correspondingDeclaredSuperType = superTypeRefs?.firstOrNull {
|
val correspondingDeclaredSuperType = superTypeRefs?.firstOrNull {
|
||||||
it.coneType.fullyExpandedType(session).classId == classId
|
it.coneType.fullyExpandedType(session).classId == classId
|
||||||
}?.coneTypeSafe<ConeClassLikeType>()?.fullyExpandedType(session) ?: return@let superType
|
}?.coneTypeSafe<ConeClassLikeType>()?.fullyExpandedType(session) ?: return@let superType
|
||||||
@@ -190,7 +189,7 @@ open class FirExpressionsResolveTransformer(transformer: FirBodyResolveTransform
|
|||||||
superReferenceContainer.resultType = actualSuperTypeRef
|
superReferenceContainer.resultType = actualSuperTypeRef
|
||||||
}
|
}
|
||||||
else -> {
|
else -> {
|
||||||
val superTypeRefs = implicitReceiver?.boundSymbol?.phasedFir?.superTypeRefs
|
val superTypeRefs = implicitReceiver?.boundSymbol?.fir?.superTypeRefs
|
||||||
val resultType = when {
|
val resultType = when {
|
||||||
superTypeRefs?.isNotEmpty() != true || containingCall == null -> {
|
superTypeRefs?.isNotEmpty() != true || containingCall == null -> {
|
||||||
buildErrorTypeRef {
|
buildErrorTypeRef {
|
||||||
@@ -656,7 +655,7 @@ open class FirExpressionsResolveTransformer(transformer: FirBodyResolveTransform
|
|||||||
lhs.typeArguments.map { it.toConeTypeProjection() }.toTypedArray()
|
lhs.typeArguments.map { it.toConeTypeProjection() }.toTypedArray()
|
||||||
} else {
|
} else {
|
||||||
// Otherwise, prepare the star projections as many as the size of type parameters.
|
// 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
|
ConeStarProjection
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user