[FIR] Store expressions of receivers inside candidates instead of ReceiverValue

This is needed because of mutable nature of receiver values: implicit
  receiver values can be modified because of smartcasts, but in candidate
  we need to store snapshot of receiver in the form it was at the beginning
  of the resolution

^KT-58823 Fixed
This commit is contained in:
Dmitriy Novozhilov
2023-06-05 10:36:55 +03:00
committed by Space Team
parent b564260a33
commit 6409bf2fe8
26 changed files with 255 additions and 181 deletions
@@ -9,6 +9,7 @@ import kotlinx.collections.immutable.PersistentList
import kotlinx.collections.immutable.persistentListOf
import kotlinx.collections.immutable.toPersistentList
import org.jetbrains.kotlin.fir.FirSession
import org.jetbrains.kotlin.fir.expressions.FirExpression
import org.jetbrains.kotlin.fir.labelName
import org.jetbrains.kotlin.fir.resolve.*
import org.jetbrains.kotlin.fir.resolve.calls.*
@@ -5,6 +5,7 @@
package org.jetbrains.kotlin.fir.resolve.calls
import org.jetbrains.kotlin.fir.expressions.FirExpression
import org.jetbrains.kotlin.fir.symbols.FirBasedSymbol
import org.jetbrains.kotlin.resolve.calls.inference.model.ConstraintSystemError
import org.jetbrains.kotlin.resolve.calls.tasks.ExplicitReceiverKind
@@ -12,8 +13,8 @@ import org.jetbrains.kotlin.resolve.calls.tower.CandidateApplicability
abstract class AbstractCandidate {
abstract val symbol: FirBasedSymbol<*>
abstract val dispatchReceiverValue: ReceiverValue?
abstract val chosenExtensionReceiverValue: ReceiverValue?
abstract val dispatchReceiver: FirExpression?
abstract val chosenExtensionReceiver: FirExpression?
abstract val explicitReceiverKind: ExplicitReceiverKind
abstract val callInfo: AbstractCallInfo
abstract val diagnostics: List<ResolutionDiagnostic>