FIR: set dispatch receiver for backing field access
This commit is contained in:
@@ -144,7 +144,7 @@ class MemberScopeTowerLevel(
|
|||||||
// We can access here members of currently accessible scope which is not influenced by explicit receiver
|
// We can access here members of currently accessible scope which is not influenced by explicit receiver
|
||||||
// We can either have no explicit receiver at all, or it can be an extension receiver
|
// We can either have no explicit receiver at all, or it can be an extension receiver
|
||||||
// An explicit receiver never can be a dispatch receiver at this level
|
// An explicit receiver never can be a dispatch receiver at this level
|
||||||
// So: dispatch receiver = strictly none (EXCEPTION: importing scopes with import from objects)
|
// So: dispatch receiver = strictly none (EXCEPTIONS: importing scopes with import from objects, synthetic field variable)
|
||||||
// So: extension receiver = either none or explicit
|
// So: extension receiver = either none or explicit
|
||||||
// (if explicit receiver exists, it always *should* be an extension receiver)
|
// (if explicit receiver exists, it always *should* be an extension receiver)
|
||||||
class ScopeTowerLevel(
|
class ScopeTowerLevel(
|
||||||
@@ -169,8 +169,12 @@ class ScopeTowerLevel(
|
|||||||
return when (token) {
|
return when (token) {
|
||||||
TowerScopeLevel.Token.Properties -> scope.processPropertiesByName(name) { candidate ->
|
TowerScopeLevel.Token.Properties -> scope.processPropertiesByName(name) { candidate ->
|
||||||
if (candidate.hasConsistentReceivers(extensionReceiver)) {
|
if (candidate.hasConsistentReceivers(extensionReceiver)) {
|
||||||
|
val dispatchReceiverValue = when (candidate) {
|
||||||
|
is FirBackingFieldSymbol -> candidate.fir.symbol.dispatchReceiverValue()
|
||||||
|
else -> null
|
||||||
|
}
|
||||||
processor.consumeCandidate(
|
processor.consumeCandidate(
|
||||||
candidate as T, dispatchReceiverValue = null,
|
candidate as T, dispatchReceiverValue = dispatchReceiverValue,
|
||||||
implicitExtensionReceiverValue = implicitExtensionReceiver
|
implicitExtensionReceiverValue = implicitExtensionReceiver
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
+1
-1
@@ -45,7 +45,7 @@ FILE: localObject.kt
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
F|/TestProperty.x| = R|<local>/value|
|
D|this@R|/TestProperty||.F|/TestProperty.x| = R|<local>/value|
|
||||||
}
|
}
|
||||||
|
|
||||||
public final val y: R|kotlin/Int|
|
public final val y: R|kotlin/Int|
|
||||||
|
|||||||
@@ -102,6 +102,7 @@ FILE fqName:<root> fileName:/initVar.kt
|
|||||||
ANONYMOUS_INITIALIZER isStatic=false
|
ANONYMOUS_INITIALIZER isStatic=false
|
||||||
BLOCK_BODY
|
BLOCK_BODY
|
||||||
SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Int visibility:public' type=kotlin.Unit origin=null
|
SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Int visibility:public' type=kotlin.Unit origin=null
|
||||||
|
receiver: GET_VAR '<this>: <root>.TestInitVarInInitBlock declared in <root>.TestInitVarInInitBlock' type=<root>.TestInitVarInInitBlock origin=null
|
||||||
value: CONST Int type=kotlin.Int value=0
|
value: CONST Int type=kotlin.Int value=0
|
||||||
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean
|
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean
|
||||||
overridden:
|
overridden:
|
||||||
@@ -139,6 +140,7 @@ FILE fqName:<root> fileName:/initVar.kt
|
|||||||
VALUE_PARAMETER name:value index:0 type:kotlin.Int
|
VALUE_PARAMETER name:value index:0 type:kotlin.Int
|
||||||
BLOCK_BODY
|
BLOCK_BODY
|
||||||
SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Int visibility:public' type=kotlin.Unit origin=null
|
SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Int visibility:public' type=kotlin.Unit origin=null
|
||||||
|
receiver: GET_VAR '<this>: <root>.TestInitVarWithCustomSetter declared in <root>.TestInitVarWithCustomSetter' type=<root>.TestInitVarWithCustomSetter origin=null
|
||||||
value: GET_VAR 'value: kotlin.Int declared in <root>.TestInitVarWithCustomSetter.<set-x>' type=kotlin.Int origin=null
|
value: GET_VAR 'value: kotlin.Int declared in <root>.TestInitVarWithCustomSetter.<set-x>' type=kotlin.Int origin=null
|
||||||
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean
|
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean
|
||||||
overridden:
|
overridden:
|
||||||
@@ -170,10 +172,12 @@ FILE fqName:<root> fileName:/initVar.kt
|
|||||||
VALUE_PARAMETER name:value index:0 type:kotlin.Int
|
VALUE_PARAMETER name:value index:0 type:kotlin.Int
|
||||||
BLOCK_BODY
|
BLOCK_BODY
|
||||||
SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Int visibility:public' type=kotlin.Unit origin=null
|
SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Int visibility:public' type=kotlin.Unit origin=null
|
||||||
|
receiver: GET_VAR '<this>: <root>.TestInitVarWithCustomSetterWithExplicitCtor declared in <root>.TestInitVarWithCustomSetterWithExplicitCtor' type=<root>.TestInitVarWithCustomSetterWithExplicitCtor origin=null
|
||||||
value: GET_VAR 'value: kotlin.Int declared in <root>.TestInitVarWithCustomSetterWithExplicitCtor.<set-x>' type=kotlin.Int origin=null
|
value: GET_VAR 'value: kotlin.Int declared in <root>.TestInitVarWithCustomSetterWithExplicitCtor.<set-x>' type=kotlin.Int origin=null
|
||||||
ANONYMOUS_INITIALIZER isStatic=false
|
ANONYMOUS_INITIALIZER isStatic=false
|
||||||
BLOCK_BODY
|
BLOCK_BODY
|
||||||
SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Int visibility:public' type=kotlin.Unit origin=null
|
SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Int visibility:public' type=kotlin.Unit origin=null
|
||||||
|
receiver: GET_VAR '<this>: <root>.TestInitVarWithCustomSetterWithExplicitCtor declared in <root>.TestInitVarWithCustomSetterWithExplicitCtor' type=<root>.TestInitVarWithCustomSetterWithExplicitCtor origin=null
|
||||||
value: CONST Int type=kotlin.Int value=0
|
value: CONST Int type=kotlin.Int value=0
|
||||||
CONSTRUCTOR visibility:public <> () returnType:<root>.TestInitVarWithCustomSetterWithExplicitCtor
|
CONSTRUCTOR visibility:public <> () returnType:<root>.TestInitVarWithCustomSetterWithExplicitCtor
|
||||||
BLOCK_BODY
|
BLOCK_BODY
|
||||||
@@ -209,10 +213,12 @@ FILE fqName:<root> fileName:/initVar.kt
|
|||||||
VALUE_PARAMETER name:value index:0 type:kotlin.Int
|
VALUE_PARAMETER name:value index:0 type:kotlin.Int
|
||||||
BLOCK_BODY
|
BLOCK_BODY
|
||||||
SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Int visibility:public' type=kotlin.Unit origin=null
|
SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Int visibility:public' type=kotlin.Unit origin=null
|
||||||
|
receiver: GET_VAR '<this>: <root>.TestInitVarWithCustomSetterInCtor declared in <root>.TestInitVarWithCustomSetterInCtor' type=<root>.TestInitVarWithCustomSetterInCtor origin=null
|
||||||
value: GET_VAR 'value: kotlin.Int declared in <root>.TestInitVarWithCustomSetterInCtor.<set-x>' type=kotlin.Int origin=null
|
value: GET_VAR 'value: kotlin.Int declared in <root>.TestInitVarWithCustomSetterInCtor.<set-x>' type=kotlin.Int origin=null
|
||||||
CONSTRUCTOR visibility:public <> () returnType:<root>.TestInitVarWithCustomSetterInCtor
|
CONSTRUCTOR visibility:public <> () returnType:<root>.TestInitVarWithCustomSetterInCtor
|
||||||
BLOCK_BODY
|
BLOCK_BODY
|
||||||
SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Int visibility:public' type=kotlin.Unit origin=null
|
SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Int visibility:public' type=kotlin.Unit origin=null
|
||||||
|
receiver: GET_VAR '<this>: <root>.TestInitVarWithCustomSetterInCtor declared in <root>.TestInitVarWithCustomSetterInCtor' type=<root>.TestInitVarWithCustomSetterInCtor origin=null
|
||||||
value: CONST Int type=kotlin.Int value=42
|
value: CONST Int type=kotlin.Int value=42
|
||||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
|
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
|
||||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:TestInitVarWithCustomSetterInCtor modality:FINAL visibility:public superTypes:[kotlin.Any]'
|
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:TestInitVarWithCustomSetterInCtor modality:FINAL visibility:public superTypes:[kotlin.Any]'
|
||||||
|
|||||||
Reference in New Issue
Block a user