diff --git a/compiler/fir/providers/src/org/jetbrains/kotlin/fir/resolve/calls/FirReceivers.kt b/compiler/fir/providers/src/org/jetbrains/kotlin/fir/resolve/calls/FirReceivers.kt index 113c991c7d0..84f0e51609a 100644 --- a/compiler/fir/providers/src/org/jetbrains/kotlin/fir/resolve/calls/FirReceivers.kt +++ b/compiler/fir/providers/src/org/jetbrains/kotlin/fir/resolve/calls/FirReceivers.kt @@ -97,7 +97,7 @@ open class ExpressionReceiverValue( sealed class ImplicitReceiverValue>( val boundSymbol: S, type: ConeKotlinType, - protected val useSiteSession: FirSession, + val useSiteSession: FirSession, protected val scopeSession: ScopeSession, private val mutable: Boolean, val contextReceiverNumber: Int = -1, @@ -110,8 +110,6 @@ sealed class ImplicitReceiverValue>( val originalType: ConeKotlinType = type - val expandedType: ConeKotlinType = type.applyIf(type is ConeClassLikeType) { fullyExpandedType(useSiteSession) } - var implicitScope: FirTypeScope? = type.scope( useSiteSession, diff --git a/compiler/fir/semantics/src/org/jetbrains/kotlin/fir/declarations/ImplicitReceiverUtils.kt b/compiler/fir/semantics/src/org/jetbrains/kotlin/fir/declarations/ImplicitReceiverUtils.kt index 0f8a4f011be..732f5b17961 100644 --- a/compiler/fir/semantics/src/org/jetbrains/kotlin/fir/declarations/ImplicitReceiverUtils.kt +++ b/compiler/fir/semantics/src/org/jetbrains/kotlin/fir/declarations/ImplicitReceiverUtils.kt @@ -276,7 +276,7 @@ class FirTowerDataElement( } private fun ImplicitReceiverValue<*>.getImplicitScope(): FirScope { - return when (expandedType) { + return when (type.fullyExpandedType(useSiteSession)) { is ConeErrorType, is ConeStubType -> FirTypeScope.Empty else -> implicitScope ?: error("Scope for type ${type::class.simpleName} is null.")