diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/TowerLevels.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/TowerLevels.kt index bf08fb50faf..3469e3c12a5 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/TowerLevels.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/TowerLevels.kt @@ -70,6 +70,7 @@ abstract class SessionBasedTowerLevel(val session: FirSession) : TowerScopeLevel return when (this) { is FirNamedFunctionSymbol -> fir.dispatchReceiverValue(session) is FirPropertySymbol -> fir.dispatchReceiverValue(session) + is FirFieldSymbol -> fir.dispatchReceiverValue(session) is FirClassSymbol -> ClassDispatchReceiverValue(fir.symbol) else -> null } diff --git a/compiler/testData/ir/irText/expressions/jvmInstanceFieldReference.fir.txt b/compiler/testData/ir/irText/expressions/jvmInstanceFieldReference.fir.txt index 8208b45f5f4..882a90ad049 100644 --- a/compiler/testData/ir/irText/expressions/jvmInstanceFieldReference.fir.txt +++ b/compiler/testData/ir/irText/expressions/jvmInstanceFieldReference.fir.txt @@ -8,12 +8,14 @@ FILE fqName: fileName:/Derived.kt ANONYMOUS_INITIALIZER isStatic=false BLOCK_BODY SET_FIELD 'FIELD IR_EXTERNAL_JAVA_DECLARATION_STUB name:value type:kotlin.Int visibility:public' type=kotlin.Unit origin=null + receiver: GET_VAR ': .Base declared in .Base' type=.Base origin=null value: CONST Int type=kotlin.Int value=0 - FUN name:getValue visibility:public modality:FINAL <> ($this:.Derived) returnType:kotlin.Int + FUN name:getValue visibility:public modality:FINAL <> ($this:.Derived) returnType:IrErrorType $this: VALUE_PARAMETER name: type:.Derived BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun getValue (): kotlin.Int declared in .Derived' + RETURN type=kotlin.Nothing from='public final fun getValue (): IrErrorType declared in .Derived' GET_FIELD 'FIELD IR_EXTERNAL_JAVA_DECLARATION_STUB name:value type:kotlin.Int visibility:public' type=kotlin.Int origin=GET_PROPERTY + receiver: GET_VAR ': .Base declared in .Base' type=.Base origin=null FUN name:setValue visibility:public modality:FINAL <> ($this:.Derived, value:kotlin.Int) returnType:kotlin.Unit $this: VALUE_PARAMETER name: type:.Derived VALUE_PARAMETER name:value index:0 type:kotlin.Int diff --git a/compiler/testData/ir/irText/expressions/kt16904.fir.txt b/compiler/testData/ir/irText/expressions/kt16904.fir.txt index 1608ce5f6b3..821c8ce8212 100644 --- a/compiler/testData/ir/irText/expressions/kt16904.fir.txt +++ b/compiler/testData/ir/irText/expressions/kt16904.fir.txt @@ -6,7 +6,7 @@ FILE fqName: fileName:/kt16904.kt DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:A modality:ABSTRACT visibility:public superTypes:[kotlin.Any]' PROPERTY name:x visibility:public modality:FINAL [val] - FIELD PROPERTY_BACKING_FIELD name:x type:.B visibility:public [final] + FIELD PROPERTY_BACKING_FIELD name:x type:.B visibility:private [final] EXPRESSION_BODY CONSTRUCTOR_CALL 'public constructor () [primary] declared in .B' type=.B origin=null FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.A) returnType:.B @@ -14,10 +14,10 @@ FILE fqName: fileName:/kt16904.kt $this: VALUE_PARAMETER name: type:.A BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun (): .B declared in .A' - GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:.B visibility:public [final]' type=.B origin=null + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:.B visibility:private [final]' type=.B origin=null receiver: GET_VAR ': .A declared in .A.' type=.A origin=null PROPERTY name:y visibility:public modality:FINAL [var] - FIELD PROPERTY_BACKING_FIELD name:y type:kotlin.Int visibility:public + FIELD PROPERTY_BACKING_FIELD name:y type:kotlin.Int visibility:private EXPRESSION_BODY CONST Int type=kotlin.Int value=0 FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.A) returnType:kotlin.Int @@ -25,14 +25,14 @@ FILE fqName: fileName:/kt16904.kt $this: VALUE_PARAMETER name: type:.A BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun (): kotlin.Int declared in .A' - GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:y type:kotlin.Int visibility:public' type=kotlin.Int origin=null + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:y type:kotlin.Int visibility:private' type=kotlin.Int origin=null receiver: GET_VAR ': .A declared in .A.' type=.A origin=null FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.A, :kotlin.Int) returnType:kotlin.Unit correspondingProperty: PROPERTY name:y visibility:public modality:FINAL [var] $this: VALUE_PARAMETER name: type:.A VALUE_PARAMETER name: index:0 type:kotlin.Int BLOCK_BODY - SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:y type:kotlin.Int visibility:public' type=kotlin.Unit origin=null + SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:y type:kotlin.Int visibility:private' type=kotlin.Unit origin=null receiver: GET_VAR ': .A declared in .A.' type=.A origin=null value: GET_VAR ': kotlin.Int declared in .A.' type=kotlin.Int origin=null FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean @@ -75,9 +75,11 @@ FILE fqName: fileName:/kt16904.kt $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Test1 CONSTRUCTOR visibility:public <> () returnType:.Test1 BLOCK_BODY - SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:.B visibility:public [final]' type=kotlin.Unit origin=null + SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:.B visibility:private [final]' type=kotlin.Unit origin=null + receiver: GET_VAR ': .A declared in .A' type=.A origin=null value: CONST Int type=.B value=42 - SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:y type:kotlin.Int visibility:public' type=kotlin.Unit origin=null + SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:y type:kotlin.Int visibility:private' type=kotlin.Unit origin=null + receiver: GET_VAR ': .A declared in .A' type=.A origin=null value: CONST Int type=kotlin.Int value=42 DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Test1 modality:FINAL visibility:public superTypes:[.A]' @@ -103,6 +105,7 @@ FILE fqName: fileName:/kt16904.kt ANONYMOUS_INITIALIZER isStatic=false BLOCK_BODY SET_FIELD 'FIELD IR_EXTERNAL_JAVA_DECLARATION_STUB name:field type:kotlin.Int visibility:public' type=kotlin.Unit origin=null + receiver: GET_VAR ': .J declared in .J' type=.J origin=null value: CONST Int type=kotlin.Int value=42 FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean overridden: diff --git a/compiler/testData/ir/irText/expressions/setFieldWithImplicitCast.fir.txt b/compiler/testData/ir/irText/expressions/setFieldWithImplicitCast.fir.txt index 2d4e13b6e43..c71bf5338e9 100644 --- a/compiler/testData/ir/irText/expressions/setFieldWithImplicitCast.fir.txt +++ b/compiler/testData/ir/irText/expressions/setFieldWithImplicitCast.fir.txt @@ -15,6 +15,7 @@ FILE fqName: fileName:/Derived.kt GET_VAR 'v: kotlin.Any declared in .Derived.setValue' type=kotlin.Any origin=null then: BLOCK type=kotlin.Unit origin=null SET_FIELD 'FIELD IR_EXTERNAL_JAVA_DECLARATION_STUB name:value type:kotlin.String? visibility:public' type=kotlin.Unit origin=null + receiver: GET_VAR ': .Base declared in .Base' type=.Base origin=null value: GET_VAR 'v: kotlin.Any declared in .Derived.setValue' type=kotlin.Any origin=null FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean overridden: