[FIR] Drop ImplicitReceiverValue.expandedType

This field cached expansion of type of implicit receiver, which is incorrect,
  because type of receiver may change because of smartcasts, but this field
  was immutable
This commit is contained in:
Dmitriy Novozhilov
2023-06-02 11:29:24 +03:00
committed by Space Team
parent c55ddab1bf
commit b564260a33
2 changed files with 2 additions and 4 deletions
@@ -97,7 +97,7 @@ open class ExpressionReceiverValue(
sealed class ImplicitReceiverValue<S : FirBasedSymbol<*>>(
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<S : FirBasedSymbol<*>>(
val originalType: ConeKotlinType = type
val expandedType: ConeKotlinType = type.applyIf(type is ConeClassLikeType) { fullyExpandedType(useSiteSession) }
var implicitScope: FirTypeScope? =
type.scope(
useSiteSession,
@@ -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.")