[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:
committed by
Space Team
parent
b564260a33
commit
6409bf2fe8
@@ -20,6 +20,7 @@ abstract class FirThisReference : FirReference() {
|
||||
abstract val labelName: String?
|
||||
abstract val boundSymbol: FirBasedSymbol<*>?
|
||||
abstract val contextReceiverNumber: Int
|
||||
abstract val isImplicit: Boolean
|
||||
|
||||
override fun <R, D> accept(visitor: FirVisitor<R, D>, data: D): R = visitor.visitThisReference(this, data)
|
||||
|
||||
|
||||
+1
@@ -23,6 +23,7 @@ internal class FirExplicitThisReference(
|
||||
override var contextReceiverNumber: Int,
|
||||
) : FirThisReference() {
|
||||
override var boundSymbol: FirBasedSymbol<*>? = null
|
||||
override val isImplicit: Boolean = false
|
||||
|
||||
override fun <R, D> acceptChildren(visitor: FirVisitor<R, D>, data: D) {}
|
||||
|
||||
|
||||
+1
@@ -23,6 +23,7 @@ internal class FirImplicitThisReference(
|
||||
) : FirThisReference() {
|
||||
override val source: KtSourceElement? get() = null
|
||||
override val labelName: String? get() = null
|
||||
override val isImplicit: Boolean = true
|
||||
|
||||
override fun <R, D> acceptChildren(visitor: FirVisitor<R, D>, data: D) {}
|
||||
|
||||
|
||||
+2
@@ -484,6 +484,7 @@ object ImplementationConfigurator : AbstractFirTreeImplementationConfigurator()
|
||||
value = "null"
|
||||
isMutable = true
|
||||
}
|
||||
defaultFalse("isImplicit")
|
||||
}
|
||||
|
||||
impl(thisReference, "FirImplicitThisReference") {
|
||||
@@ -495,6 +496,7 @@ object ImplementationConfigurator : AbstractFirTreeImplementationConfigurator()
|
||||
default("boundSymbol") {
|
||||
isMutable = false
|
||||
}
|
||||
defaultTrue("isImplicit")
|
||||
}
|
||||
|
||||
impl(superReference, "FirExplicitSuperReference")
|
||||
|
||||
+1
@@ -687,6 +687,7 @@ object NodeConfigurator : AbstractFieldConfigurator<FirTreeBuilder>(FirTreeBuild
|
||||
+stringField("labelName", nullable = true)
|
||||
+field("boundSymbol", firBasedSymbolType, "*", nullable = true, withReplace = true)
|
||||
+intField("contextReceiverNumber", withReplace = true)
|
||||
+booleanField("isImplicit")
|
||||
}
|
||||
|
||||
typeRef.configure {
|
||||
|
||||
Reference in New Issue
Block a user