diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/CallAndReferenceGenerator.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/CallAndReferenceGenerator.kt index f7a01443ef1..59c874f32dd 100644 --- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/CallAndReferenceGenerator.kt +++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/CallAndReferenceGenerator.kt @@ -13,6 +13,7 @@ import org.jetbrains.kotlin.fir.declarations.FirClass import org.jetbrains.kotlin.fir.declarations.FirRegularClass import org.jetbrains.kotlin.fir.expressions.* import org.jetbrains.kotlin.fir.expressions.impl.FirNoReceiverExpression +import org.jetbrains.kotlin.fir.psi import org.jetbrains.kotlin.fir.references.FirDelegateFieldReference import org.jetbrains.kotlin.fir.references.FirReference import org.jetbrains.kotlin.fir.references.FirResolvedNamedReference @@ -37,6 +38,7 @@ import org.jetbrains.kotlin.ir.types.IrType import org.jetbrains.kotlin.ir.types.classifierOrNull import org.jetbrains.kotlin.ir.types.makeNotNull import org.jetbrains.kotlin.ir.util.defaultType +import org.jetbrains.kotlin.psi.KtPropertyDelegate internal class CallAndReferenceGenerator( private val components: Fir2IrComponents, @@ -60,12 +62,17 @@ internal class CallAndReferenceGenerator( referencedPropertyGetter != null -> null else -> referencedProperty.backingField?.symbol } + val origin = when (callableReferenceAccess.source?.psi?.parent) { + is KtPropertyDelegate -> IrStatementOrigin.PROPERTY_REFERENCE_FOR_DELEGATE + else -> null + } IrPropertyReferenceImpl( startOffset, endOffset, type, symbol, typeArgumentsCount = referencedPropertyGetter?.typeParameters?.size ?: 0, backingFieldSymbol, referencedPropertyGetter?.symbol, - referencedProperty.setter?.symbol + referencedProperty.setter?.symbol, + origin ) } is IrConstructorSymbol -> { diff --git a/compiler/fir/raw-fir/fir-common/src/org/jetbrains/kotlin/fir/builder/ConversionUtils.kt b/compiler/fir/raw-fir/fir-common/src/org/jetbrains/kotlin/fir/builder/ConversionUtils.kt index 31bf5611088..a19526b1319 100644 --- a/compiler/fir/raw-fir/fir-common/src/org/jetbrains/kotlin/fir/builder/ConversionUtils.kt +++ b/compiler/fir/raw-fir/fir-common/src/org/jetbrains/kotlin/fir/builder/ConversionUtils.kt @@ -312,7 +312,7 @@ fun FirPropertyBuilder.generateAccessorsByDelegate( } fun delegateAccess() = buildQualifiedAccessExpression { - source = null + source = delegateBuilder.source calleeReference = buildDelegateFieldReference { resolvedSymbol = delegateFieldSymbol } @@ -320,15 +320,15 @@ fun FirPropertyBuilder.generateAccessorsByDelegate( fun thisRef(): FirExpression = if (member || extension) buildQualifiedAccessExpression { - source = null + source = delegateBuilder.source calleeReference = buildExplicitThisReference {} } else buildConstExpression(null, FirConstKind.Null, null) fun propertyRef() = buildCallableReferenceAccess { - source = null + source = delegateBuilder.source calleeReference = buildResolvedNamedReference { - source = null + source = delegateBuilder.source name = this@generateAccessorsByDelegate.name resolvedSymbol = this@generateAccessorsByDelegate.symbol } @@ -338,7 +338,7 @@ fun FirPropertyBuilder.generateAccessorsByDelegate( delegateBuilder.delegateProvider = if (stubMode) buildExpressionStub() else buildFunctionCall { explicitReceiver = receiver calleeReference = buildSimpleNamedReference { - source = null + source = delegateBuilder.source name = PROVIDE_DELEGATE } argumentList = buildBinaryArgumentList(thisRef(), propertyRef()) @@ -357,10 +357,10 @@ fun FirPropertyBuilder.generateAccessorsByDelegate( body = FirSingleExpressionBlock( buildReturnExpression { result = buildFunctionCall { - source = null + source = delegateBuilder.source explicitReceiver = delegateAccess() calleeReference = buildSimpleNamedReference { - source = null + source = delegateBuilder.source name = GET_VALUE } argumentList = buildBinaryArgumentList(thisRef(), propertyRef()) diff --git a/compiler/testData/ir/irText/declarations/annotations/delegateFieldWithAnnotations.fir.txt b/compiler/testData/ir/irText/declarations/annotations/delegateFieldWithAnnotations.fir.txt index 60a44f1511d..d5adb56799b 100644 --- a/compiler/testData/ir/irText/declarations/annotations/delegateFieldWithAnnotations.fir.txt +++ b/compiler/testData/ir/irText/declarations/annotations/delegateFieldWithAnnotations.fir.txt @@ -35,4 +35,4 @@ FILE fqName: fileName:/delegateFieldWithAnnotations.kt : kotlin.Int $receiver: GET_FIELD 'FIELD PROPERTY_DELEGATE name:test1$delegate type:kotlin.Lazy visibility:private [final,static]' type=kotlin.Lazy origin=null thisRef: CONST Null type=kotlin.Nothing? value=null - property: PROPERTY_REFERENCE 'public final test1: kotlin.Int [delegated,val]' field=null getter='public final fun (): kotlin.Int declared in ' setter=null type=kotlin.reflect.KProperty<*> origin=null + property: PROPERTY_REFERENCE 'public final test1: kotlin.Int [delegated,val]' field=null getter='public final fun (): kotlin.Int declared in ' setter=null type=kotlin.reflect.KProperty<*> origin=PROPERTY_REFERENCE_FOR_DELEGATE diff --git a/compiler/testData/ir/irText/declarations/annotations/delegatedPropertyAccessorsWithAnnotations.fir.txt b/compiler/testData/ir/irText/declarations/annotations/delegatedPropertyAccessorsWithAnnotations.fir.txt index f70e7e39d6f..5d9cceb1409 100644 --- a/compiler/testData/ir/irText/declarations/annotations/delegatedPropertyAccessorsWithAnnotations.fir.txt +++ b/compiler/testData/ir/irText/declarations/annotations/delegatedPropertyAccessorsWithAnnotations.fir.txt @@ -97,7 +97,7 @@ FILE fqName: fileName:/delegatedPropertyAccessorsWithAnnotations.kt CALL 'public final fun getValue (thisRef: kotlin.Any?, kProp: kotlin.Any?): kotlin.Int [operator] declared in .Cell' type=kotlin.Int origin=null $this: GET_FIELD 'FIELD PROPERTY_DELEGATE name:test1$delegate type:.Cell visibility:private [final,static]' type=.Cell origin=null thisRef: CONST Null type=kotlin.Nothing? value=null - kProp: PROPERTY_REFERENCE 'public final test1: kotlin.Int [delegated,val]' field=null getter='public final fun (): kotlin.Int declared in ' setter=null type=kotlin.reflect.KProperty<*> origin=null + kProp: PROPERTY_REFERENCE 'public final test1: kotlin.Int [delegated,val]' field=null getter='public final fun (): kotlin.Int declared in ' setter=null type=kotlin.reflect.KProperty<*> origin=PROPERTY_REFERENCE_FOR_DELEGATE PROPERTY name:test2 visibility:public modality:FINAL [delegated,var] annotations: A(x = 'test2.get') @@ -114,7 +114,7 @@ FILE fqName: fileName:/delegatedPropertyAccessorsWithAnnotations.kt CALL 'public final fun getValue (thisRef: kotlin.Any?, kProp: kotlin.Any?): kotlin.Int [operator] declared in .Cell' type=kotlin.Int origin=null $this: GET_FIELD 'FIELD PROPERTY_DELEGATE name:test2$delegate type:.Cell visibility:private [final,static]' type=.Cell origin=null thisRef: CONST Null type=kotlin.Nothing? value=null - kProp: PROPERTY_REFERENCE 'public final test2: kotlin.Int [delegated,var]' field=null getter='public final fun (): kotlin.Int declared in ' setter='public final fun (: kotlin.Int): kotlin.Unit declared in ' type=kotlin.reflect.KProperty<*> origin=null + kProp: PROPERTY_REFERENCE 'public final test2: kotlin.Int [delegated,var]' field=null getter='public final fun (): kotlin.Int declared in ' setter='public final fun (: kotlin.Int): kotlin.Unit declared in ' type=kotlin.reflect.KProperty<*> origin=PROPERTY_REFERENCE_FOR_DELEGATE FUN DELEGATED_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> (:kotlin.Int) returnType:kotlin.Unit correspondingProperty: PROPERTY name:test2 visibility:public modality:FINAL [delegated,var] VALUE_PARAMETER name: index:0 type:kotlin.Int @@ -122,5 +122,5 @@ FILE fqName: fileName:/delegatedPropertyAccessorsWithAnnotations.kt CALL 'public final fun setValue (thisRef: kotlin.Any?, kProp: kotlin.Any?, newValue: kotlin.Int): kotlin.Unit [operator] declared in .Cell' type=kotlin.Unit origin=null $this: GET_FIELD 'FIELD PROPERTY_DELEGATE name:test2$delegate type:.Cell visibility:private [final,static]' type=.Cell origin=null thisRef: CONST Null type=kotlin.Nothing? value=null - kProp: PROPERTY_REFERENCE 'public final test2: kotlin.Int [delegated,var]' field=null getter='public final fun (): kotlin.Int declared in ' setter='public final fun (: kotlin.Int): kotlin.Unit declared in ' type=kotlin.reflect.KProperty<*> origin=null + kProp: PROPERTY_REFERENCE 'public final test2: kotlin.Int [delegated,var]' field=null getter='public final fun (): kotlin.Int declared in ' setter='public final fun (: kotlin.Int): kotlin.Unit declared in ' type=kotlin.reflect.KProperty<*> origin=PROPERTY_REFERENCE_FOR_DELEGATE newValue: GET_VAR ': kotlin.Int declared in .' type=kotlin.Int origin=null diff --git a/compiler/testData/ir/irText/declarations/classLevelProperties.fir.txt b/compiler/testData/ir/irText/declarations/classLevelProperties.fir.txt index 72d9ec8d037..053a6efb0fa 100644 --- a/compiler/testData/ir/irText/declarations/classLevelProperties.fir.txt +++ b/compiler/testData/ir/irText/declarations/classLevelProperties.fir.txt @@ -110,7 +110,7 @@ FILE fqName: fileName:/classLevelProperties.kt : kotlin.Int $receiver: GET_FIELD 'FIELD PROPERTY_DELEGATE name:test7$delegate type:kotlin.Lazy visibility:private [final]' type=kotlin.Lazy origin=null thisRef: GET_VAR ': .C declared in .C' type=.C origin=null - property: PROPERTY_REFERENCE 'public final test7: kotlin.Int [delegated,val]' field=null getter='public final fun (): kotlin.Int declared in .C' setter=null type=kotlin.reflect.KProperty<*> origin=null + property: PROPERTY_REFERENCE 'public final test7: kotlin.Int [delegated,val]' field=null getter='public final fun (): kotlin.Int declared in .C' setter=null type=kotlin.reflect.KProperty<*> origin=PROPERTY_REFERENCE_FOR_DELEGATE PROPERTY name:test8 visibility:public modality:FINAL [delegated,var] FIELD PROPERTY_DELEGATE name:test8$delegate type:java.util.HashMap visibility:private [final] EXPRESSION_BODY @@ -124,7 +124,7 @@ FILE fqName: fileName:/classLevelProperties.kt RETURN type=kotlin.Nothing from='public final fun (): IrErrorType declared in .C' ERROR_CALL 'Unresolved reference: #' type=IrErrorType GET_VAR ': .C declared in .C' type=.C origin=null - PROPERTY_REFERENCE 'public final test8: IrErrorType [delegated,var]' field=null getter='public final fun (): IrErrorType declared in .C' setter='public final fun (: IrErrorType): kotlin.Unit declared in .C' type=kotlin.reflect.KProperty<*> origin=null + PROPERTY_REFERENCE 'public final test8: IrErrorType [delegated,var]' field=null getter='public final fun (): IrErrorType declared in .C' setter='public final fun (: IrErrorType): kotlin.Unit declared in .C' type=kotlin.reflect.KProperty<*> origin=PROPERTY_REFERENCE_FOR_DELEGATE FUN DELEGATED_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.C, :IrErrorType) returnType:kotlin.Unit correspondingProperty: PROPERTY name:test8 visibility:public modality:FINAL [delegated,var] $this: VALUE_PARAMETER name: type:.C @@ -132,7 +132,7 @@ FILE fqName: fileName:/classLevelProperties.kt BLOCK_BODY ERROR_CALL 'Unresolved reference: #' type=IrErrorType GET_VAR ': .C declared in .C' type=.C origin=null - PROPERTY_REFERENCE 'public final test8: IrErrorType [delegated,var]' field=null getter='public final fun (): IrErrorType declared in .C' setter='public final fun (: IrErrorType): kotlin.Unit declared in .C' type=kotlin.reflect.KProperty<*> origin=null + PROPERTY_REFERENCE 'public final test8: IrErrorType [delegated,var]' field=null getter='public final fun (): IrErrorType declared in .C' setter='public final fun (: IrErrorType): kotlin.Unit declared in .C' type=kotlin.reflect.KProperty<*> origin=PROPERTY_REFERENCE_FOR_DELEGATE GET_VAR ': IrErrorType declared in .C.' type=IrErrorType origin=null FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] overridden: diff --git a/compiler/testData/ir/irText/declarations/delegatedProperties.fir.txt b/compiler/testData/ir/irText/declarations/delegatedProperties.fir.txt index 88b645f7798..41e21488833 100644 --- a/compiler/testData/ir/irText/declarations/delegatedProperties.fir.txt +++ b/compiler/testData/ir/irText/declarations/delegatedProperties.fir.txt @@ -17,7 +17,7 @@ FILE fqName: fileName:/delegatedProperties.kt : kotlin.Int $receiver: GET_FIELD 'FIELD PROPERTY_DELEGATE name:test1$delegate type:kotlin.Lazy visibility:private [final,static]' type=kotlin.Lazy origin=null thisRef: CONST Null type=kotlin.Nothing? value=null - property: PROPERTY_REFERENCE 'public final test1: kotlin.Int [delegated,val]' field=null getter='public final fun (): kotlin.Int declared in ' setter=null type=kotlin.reflect.KProperty<*> origin=null + property: PROPERTY_REFERENCE 'public final test1: kotlin.Int [delegated,val]' field=null getter='public final fun (): kotlin.Int declared in ' setter=null type=kotlin.reflect.KProperty<*> origin=PROPERTY_REFERENCE_FOR_DELEGATE CLASS CLASS name:C modality:FINAL visibility:public superTypes:[kotlin.Any] $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.C CONSTRUCTOR visibility:public <> (map:kotlin.collections.MutableMap) returnType:.C [primary] @@ -55,7 +55,7 @@ FILE fqName: fileName:/delegatedProperties.kt : kotlin.Int $receiver: GET_FIELD 'FIELD PROPERTY_DELEGATE name:test2$delegate type:kotlin.Lazy visibility:private [final]' type=kotlin.Lazy origin=null thisRef: GET_VAR ': .C declared in .C' type=.C origin=null - property: PROPERTY_REFERENCE 'public final test2: kotlin.Int [delegated,val]' field=null getter='public final fun (): kotlin.Int declared in .C' setter=null type=kotlin.reflect.KProperty<*> origin=null + property: PROPERTY_REFERENCE 'public final test2: kotlin.Int [delegated,val]' field=null getter='public final fun (): kotlin.Int declared in .C' setter=null type=kotlin.reflect.KProperty<*> origin=PROPERTY_REFERENCE_FOR_DELEGATE PROPERTY name:test3 visibility:public modality:FINAL [delegated,var] FIELD PROPERTY_DELEGATE name:test3$delegate type:kotlin.collections.MutableMap visibility:private [final] EXPRESSION_BODY @@ -67,7 +67,7 @@ FILE fqName: fileName:/delegatedProperties.kt RETURN type=kotlin.Nothing from='public final fun (): IrErrorType declared in .C' ERROR_CALL 'Unresolved reference: #' type=IrErrorType GET_VAR ': .C declared in .C' type=.C origin=null - PROPERTY_REFERENCE 'public final test3: IrErrorType [delegated,var]' field=null getter='public final fun (): IrErrorType declared in .C' setter='public final fun (: IrErrorType): kotlin.Unit declared in .C' type=kotlin.reflect.KProperty<*> origin=null + PROPERTY_REFERENCE 'public final test3: IrErrorType [delegated,var]' field=null getter='public final fun (): IrErrorType declared in .C' setter='public final fun (: IrErrorType): kotlin.Unit declared in .C' type=kotlin.reflect.KProperty<*> origin=PROPERTY_REFERENCE_FOR_DELEGATE FUN DELEGATED_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.C, :IrErrorType) returnType:kotlin.Unit correspondingProperty: PROPERTY name:test3 visibility:public modality:FINAL [delegated,var] $this: VALUE_PARAMETER name: type:.C @@ -75,7 +75,7 @@ FILE fqName: fileName:/delegatedProperties.kt BLOCK_BODY ERROR_CALL 'Unresolved reference: #' type=IrErrorType GET_VAR ': .C declared in .C' type=.C origin=null - PROPERTY_REFERENCE 'public final test3: IrErrorType [delegated,var]' field=null getter='public final fun (): IrErrorType declared in .C' setter='public final fun (: IrErrorType): kotlin.Unit declared in .C' type=kotlin.reflect.KProperty<*> origin=null + PROPERTY_REFERENCE 'public final test3: IrErrorType [delegated,var]' field=null getter='public final fun (): IrErrorType declared in .C' setter='public final fun (: IrErrorType): kotlin.Unit declared in .C' type=kotlin.reflect.KProperty<*> origin=PROPERTY_REFERENCE_FOR_DELEGATE GET_VAR ': IrErrorType declared in .C.' type=IrErrorType origin=null FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] overridden: @@ -102,12 +102,12 @@ FILE fqName: fileName:/delegatedProperties.kt RETURN type=kotlin.Nothing from='public final fun (): IrErrorType declared in ' ERROR_CALL 'Unresolved reference: #' type=IrErrorType CONST Null type=kotlin.Nothing? value=null - PROPERTY_REFERENCE 'public final test4: IrErrorType [delegated,var]' field=null getter='public final fun (): IrErrorType declared in ' setter='public final fun (: IrErrorType): kotlin.Unit declared in ' type=kotlin.reflect.KProperty<*> origin=null + PROPERTY_REFERENCE 'public final test4: IrErrorType [delegated,var]' field=null getter='public final fun (): IrErrorType declared in ' setter='public final fun (: IrErrorType): kotlin.Unit declared in ' type=kotlin.reflect.KProperty<*> origin=PROPERTY_REFERENCE_FOR_DELEGATE FUN DELEGATED_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> (:IrErrorType) returnType:kotlin.Unit correspondingProperty: PROPERTY name:test4 visibility:public modality:FINAL [delegated,var] VALUE_PARAMETER name: index:0 type:IrErrorType BLOCK_BODY ERROR_CALL 'Unresolved reference: #' type=IrErrorType CONST Null type=kotlin.Nothing? value=null - PROPERTY_REFERENCE 'public final test4: IrErrorType [delegated,var]' field=null getter='public final fun (): IrErrorType declared in ' setter='public final fun (: IrErrorType): kotlin.Unit declared in ' type=kotlin.reflect.KProperty<*> origin=null + PROPERTY_REFERENCE 'public final test4: IrErrorType [delegated,var]' field=null getter='public final fun (): IrErrorType declared in ' setter='public final fun (: IrErrorType): kotlin.Unit declared in ' type=kotlin.reflect.KProperty<*> origin=PROPERTY_REFERENCE_FOR_DELEGATE GET_VAR ': IrErrorType declared in .' type=IrErrorType origin=null diff --git a/compiler/testData/ir/irText/declarations/packageLevelProperties.fir.txt b/compiler/testData/ir/irText/declarations/packageLevelProperties.fir.txt index 34dddeef30d..b166be6f531 100644 --- a/compiler/testData/ir/irText/declarations/packageLevelProperties.fir.txt +++ b/compiler/testData/ir/irText/declarations/packageLevelProperties.fir.txt @@ -86,7 +86,7 @@ FILE fqName: fileName:/packageLevelProperties.kt : kotlin.Int $receiver: GET_FIELD 'FIELD PROPERTY_DELEGATE name:test7$delegate type:kotlin.Lazy visibility:private [final,static]' type=kotlin.Lazy origin=null thisRef: CONST Null type=kotlin.Nothing? value=null - property: PROPERTY_REFERENCE 'public final test7: kotlin.Int [delegated,val]' field=null getter='public final fun (): kotlin.Int declared in ' setter=null type=kotlin.reflect.KProperty<*> origin=null + property: PROPERTY_REFERENCE 'public final test7: kotlin.Int [delegated,val]' field=null getter='public final fun (): kotlin.Int declared in ' setter=null type=kotlin.reflect.KProperty<*> origin=PROPERTY_REFERENCE_FOR_DELEGATE PROPERTY name:test8 visibility:public modality:FINAL [delegated,var] FIELD PROPERTY_DELEGATE name:test8$delegate type:java.util.HashMap visibility:private [final,static] EXPRESSION_BODY @@ -99,12 +99,12 @@ FILE fqName: fileName:/packageLevelProperties.kt RETURN type=kotlin.Nothing from='public final fun (): IrErrorType declared in ' ERROR_CALL 'Unresolved reference: #' type=IrErrorType CONST Null type=kotlin.Nothing? value=null - PROPERTY_REFERENCE 'public final test8: IrErrorType [delegated,var]' field=null getter='public final fun (): IrErrorType declared in ' setter='public final fun (: IrErrorType): kotlin.Unit declared in ' type=kotlin.reflect.KProperty<*> origin=null + PROPERTY_REFERENCE 'public final test8: IrErrorType [delegated,var]' field=null getter='public final fun (): IrErrorType declared in ' setter='public final fun (: IrErrorType): kotlin.Unit declared in ' type=kotlin.reflect.KProperty<*> origin=PROPERTY_REFERENCE_FOR_DELEGATE FUN DELEGATED_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> (:IrErrorType) returnType:kotlin.Unit correspondingProperty: PROPERTY name:test8 visibility:public modality:FINAL [delegated,var] VALUE_PARAMETER name: index:0 type:IrErrorType BLOCK_BODY ERROR_CALL 'Unresolved reference: #' type=IrErrorType CONST Null type=kotlin.Nothing? value=null - PROPERTY_REFERENCE 'public final test8: IrErrorType [delegated,var]' field=null getter='public final fun (): IrErrorType declared in ' setter='public final fun (: IrErrorType): kotlin.Unit declared in ' type=kotlin.reflect.KProperty<*> origin=null + PROPERTY_REFERENCE 'public final test8: IrErrorType [delegated,var]' field=null getter='public final fun (): IrErrorType declared in ' setter='public final fun (: IrErrorType): kotlin.Unit declared in ' type=kotlin.reflect.KProperty<*> origin=PROPERTY_REFERENCE_FOR_DELEGATE GET_VAR ': IrErrorType declared in .' type=IrErrorType origin=null diff --git a/compiler/testData/ir/irText/declarations/provideDelegate/differentReceivers.fir.txt b/compiler/testData/ir/irText/declarations/provideDelegate/differentReceivers.fir.txt index d4cf389a120..bef73d969b4 100644 --- a/compiler/testData/ir/irText/declarations/provideDelegate/differentReceivers.fir.txt +++ b/compiler/testData/ir/irText/declarations/provideDelegate/differentReceivers.fir.txt @@ -52,7 +52,7 @@ FILE fqName: fileName:/differentReceivers.kt $receiver: CONSTRUCTOR_CALL 'public constructor (value: kotlin.String) [primary] declared in .MyClass' type=.MyClass origin=null value: CONST String type=kotlin.String value="O" host: CONST Null type=kotlin.Nothing? value=null - p: PROPERTY_REFERENCE 'public final testO: kotlin.String [delegated,val]' field=null getter='public final fun (): kotlin.String declared in ' setter=null type=kotlin.reflect.KProperty<*> origin=null + p: PROPERTY_REFERENCE 'public final testO: kotlin.String [delegated,val]' field=null getter='public final fun (): kotlin.String declared in ' setter=null type=kotlin.reflect.KProperty<*> origin=PROPERTY_REFERENCE_FOR_DELEGATE FUN DELEGATED_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> () returnType:kotlin.String correspondingProperty: PROPERTY name:testO visibility:public modality:FINAL [delegated,val] BLOCK_BODY @@ -60,7 +60,7 @@ FILE fqName: fileName:/differentReceivers.kt CALL 'public final fun getValue (receiver: kotlin.Any?, p: kotlin.Any): kotlin.String [operator] declared in ' type=kotlin.String origin=null $receiver: GET_FIELD 'FIELD PROPERTY_DELEGATE name:testO$delegate type:kotlin.String visibility:private [final,static]' type=kotlin.String origin=null receiver: CONST Null type=kotlin.Nothing? value=null - p: PROPERTY_REFERENCE 'public final testO: kotlin.String [delegated,val]' field=null getter='public final fun (): kotlin.String declared in ' setter=null type=kotlin.reflect.KProperty<*> origin=null + p: PROPERTY_REFERENCE 'public final testO: kotlin.String [delegated,val]' field=null getter='public final fun (): kotlin.String declared in ' setter=null type=kotlin.reflect.KProperty<*> origin=PROPERTY_REFERENCE_FOR_DELEGATE PROPERTY name:testK visibility:public modality:FINAL [delegated,val] FIELD PROPERTY_DELEGATE name:testK$delegate type:kotlin.String visibility:private [final,static] EXPRESSION_BODY @@ -72,7 +72,7 @@ FILE fqName: fileName:/differentReceivers.kt CALL 'public final fun getValue (receiver: kotlin.Any?, p: kotlin.Any): kotlin.String [operator] declared in ' type=kotlin.String origin=null $receiver: GET_FIELD 'FIELD PROPERTY_DELEGATE name:testK$delegate type:kotlin.String visibility:private [final,static]' type=kotlin.String origin=null receiver: CONST Null type=kotlin.Nothing? value=null - p: PROPERTY_REFERENCE 'public final testK: kotlin.String [delegated,val]' field=null getter='public final fun (): kotlin.String declared in ' setter=null type=kotlin.reflect.KProperty<*> origin=null + p: PROPERTY_REFERENCE 'public final testK: kotlin.String [delegated,val]' field=null getter='public final fun (): kotlin.String declared in ' setter=null type=kotlin.reflect.KProperty<*> origin=PROPERTY_REFERENCE_FOR_DELEGATE PROPERTY name:testOK visibility:public modality:FINAL [val] FIELD PROPERTY_BACKING_FIELD name:testOK type:kotlin.String visibility:private [final,static] EXPRESSION_BODY diff --git a/compiler/testData/ir/irText/declarations/provideDelegate/member.fir.txt b/compiler/testData/ir/irText/declarations/provideDelegate/member.fir.txt index ad90270c328..0ba5d8769cd 100644 --- a/compiler/testData/ir/irText/declarations/provideDelegate/member.fir.txt +++ b/compiler/testData/ir/irText/declarations/provideDelegate/member.fir.txt @@ -91,7 +91,7 @@ FILE fqName: fileName:/member.kt $this: CONSTRUCTOR_CALL 'public constructor (value: kotlin.String) [primary] declared in .DelegateProvider' type=.DelegateProvider origin=null value: CONST String type=kotlin.String value="OK" thisRef: GET_VAR ': .Host declared in .Host' type=.Host origin=null - property: PROPERTY_REFERENCE 'public final testMember: kotlin.String [delegated,val]' field=null getter='public final fun (): kotlin.String declared in .Host' setter=null type=kotlin.reflect.KProperty<*> origin=null + property: PROPERTY_REFERENCE 'public final testMember: kotlin.String [delegated,val]' field=null getter='public final fun (): kotlin.String declared in .Host' setter=null type=kotlin.reflect.KProperty<*> origin=PROPERTY_REFERENCE_FOR_DELEGATE FUN DELEGATED_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.Host) returnType:kotlin.String correspondingProperty: PROPERTY name:testMember visibility:public modality:FINAL [delegated,val] $this: VALUE_PARAMETER name: type:.Host @@ -100,7 +100,7 @@ FILE fqName: fileName:/member.kt CALL 'public final fun getValue (thisRef: kotlin.Any?, property: kotlin.Any?): kotlin.String [operator] declared in .Delegate' type=kotlin.String origin=null $this: GET_FIELD 'FIELD PROPERTY_DELEGATE name:testMember$delegate type:.Delegate visibility:private [final]' type=.Delegate origin=null thisRef: GET_VAR ': .Host declared in .Host' type=.Host origin=null - property: PROPERTY_REFERENCE 'public final testMember: kotlin.String [delegated,val]' field=null getter='public final fun (): kotlin.String declared in .Host' setter=null type=kotlin.reflect.KProperty<*> origin=null + property: PROPERTY_REFERENCE 'public final testMember: kotlin.String [delegated,val]' field=null getter='public final fun (): kotlin.String declared in .Host' setter=null type=kotlin.reflect.KProperty<*> origin=PROPERTY_REFERENCE_FOR_DELEGATE FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] overridden: public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any diff --git a/compiler/testData/ir/irText/declarations/provideDelegate/memberExtension.fir.txt b/compiler/testData/ir/irText/declarations/provideDelegate/memberExtension.fir.txt index 218df789493..3ce92d20f80 100644 --- a/compiler/testData/ir/irText/declarations/provideDelegate/memberExtension.fir.txt +++ b/compiler/testData/ir/irText/declarations/provideDelegate/memberExtension.fir.txt @@ -62,7 +62,7 @@ FILE fqName: fileName:/memberExtension.kt $this: GET_VAR ': .Host declared in .Host' type=.Host origin=null $receiver: CONST String type=kotlin.String value="K" host: GET_VAR ': .Host declared in .Host' type=.Host origin=null - p: PROPERTY_REFERENCE 'public final plusK: kotlin.String [delegated,val]' field=null getter='public final fun (): kotlin.String declared in .Host' setter=null type=kotlin.reflect.KProperty<*> origin=null + p: PROPERTY_REFERENCE 'public final plusK: kotlin.String [delegated,val]' field=null getter='public final fun (): kotlin.String declared in .Host' setter=null type=kotlin.reflect.KProperty<*> origin=PROPERTY_REFERENCE_FOR_DELEGATE $this: GET_OBJECT 'CLASS OBJECT name:Host modality:FINAL visibility:public superTypes:[kotlin.Any]' type=.Host $receiver: GET_OBJECT 'CLASS OBJECT name:Host modality:FINAL visibility:public superTypes:[kotlin.Any]' type=.Host FUN DELEGATED_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.Host, $receiver:kotlin.String) returnType:kotlin.String @@ -75,7 +75,7 @@ FILE fqName: fileName:/memberExtension.kt $this: GET_FIELD 'FIELD PROPERTY_DELEGATE name:plusK$delegate type:.Host.StringDelegate visibility:private [final]' type=.Host.StringDelegate origin=null receiver: GET_OBJECT 'CLASS OBJECT name:Host modality:FINAL visibility:public superTypes:[kotlin.Any]' type=.Host receiver: ERROR_CALL 'Unresolved reference: this@R|/Host.plusK|' type=kotlin.String - p: PROPERTY_REFERENCE 'public final plusK: kotlin.String [delegated,val]' field=null getter='public final fun (): kotlin.String declared in .Host' setter=null type=kotlin.reflect.KProperty<*> origin=null + p: PROPERTY_REFERENCE 'public final plusK: kotlin.String [delegated,val]' field=null getter='public final fun (): kotlin.String declared in .Host' setter=null type=kotlin.reflect.KProperty<*> origin=PROPERTY_REFERENCE_FOR_DELEGATE $this: GET_OBJECT 'CLASS OBJECT name:Host modality:FINAL visibility:public superTypes:[kotlin.Any]' type=.Host $receiver: GET_OBJECT 'CLASS OBJECT name:Host modality:FINAL visibility:public superTypes:[kotlin.Any]' type=.Host PROPERTY name:ok visibility:public modality:FINAL [val] diff --git a/compiler/testData/ir/irText/declarations/provideDelegate/topLevel.fir.txt b/compiler/testData/ir/irText/declarations/provideDelegate/topLevel.fir.txt index 39e7f9c0f2e..ca074d00b39 100644 --- a/compiler/testData/ir/irText/declarations/provideDelegate/topLevel.fir.txt +++ b/compiler/testData/ir/irText/declarations/provideDelegate/topLevel.fir.txt @@ -85,7 +85,7 @@ FILE fqName: fileName:/topLevel.kt $this: CONSTRUCTOR_CALL 'public constructor (value: kotlin.String) [primary] declared in .DelegateProvider' type=.DelegateProvider origin=null value: CONST String type=kotlin.String value="OK" thisRef: CONST Null type=kotlin.Nothing? value=null - property: PROPERTY_REFERENCE 'public final testTopLevel: kotlin.String [delegated,val]' field=null getter='public final fun (): kotlin.String declared in ' setter=null type=kotlin.reflect.KProperty<*> origin=null + property: PROPERTY_REFERENCE 'public final testTopLevel: kotlin.String [delegated,val]' field=null getter='public final fun (): kotlin.String declared in ' setter=null type=kotlin.reflect.KProperty<*> origin=PROPERTY_REFERENCE_FOR_DELEGATE FUN DELEGATED_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> () returnType:kotlin.String correspondingProperty: PROPERTY name:testTopLevel visibility:public modality:FINAL [delegated,val] BLOCK_BODY @@ -93,4 +93,4 @@ FILE fqName: fileName:/topLevel.kt CALL 'public final fun getValue (thisRef: kotlin.Any?, property: kotlin.Any?): kotlin.String [operator] declared in .Delegate' type=kotlin.String origin=null $this: GET_FIELD 'FIELD PROPERTY_DELEGATE name:testTopLevel$delegate type:.Delegate visibility:private [final,static]' type=.Delegate origin=null thisRef: CONST Null type=kotlin.Nothing? value=null - property: PROPERTY_REFERENCE 'public final testTopLevel: kotlin.String [delegated,val]' field=null getter='public final fun (): kotlin.String declared in ' setter=null type=kotlin.reflect.KProperty<*> origin=null + property: PROPERTY_REFERENCE 'public final testTopLevel: kotlin.String [delegated,val]' field=null getter='public final fun (): kotlin.String declared in ' setter=null type=kotlin.reflect.KProperty<*> origin=PROPERTY_REFERENCE_FOR_DELEGATE diff --git a/compiler/testData/ir/irText/expressions/genericPropertyRef.fir.txt b/compiler/testData/ir/irText/expressions/genericPropertyRef.fir.txt index ebd8194eefd..58038a1bf03 100644 --- a/compiler/testData/ir/irText/expressions/genericPropertyRef.fir.txt +++ b/compiler/testData/ir/irText/expressions/genericPropertyRef.fir.txt @@ -78,7 +78,7 @@ FILE fqName: fileName:/genericPropertyRef.kt CALL 'public final fun getValue (t: kotlin.Any?, p: kotlin.Any): kotlin.Int [operator] declared in .DVal' type=kotlin.Int origin=null $this: GET_FIELD 'FIELD PROPERTY_DELEGATE name:additionalText$delegate type:.DVal visibility:private [final,static]' type=.DVal origin=null t: ERROR_CALL 'Unresolved reference: this@R|/additionalText|' type=.Value.> - p: PROPERTY_REFERENCE 'public final additionalText: kotlin.Int [delegated,val]' field=null getter='public final fun (): kotlin.Int declared in ' setter=null type=kotlin.reflect.KProperty<*> origin=null + p: PROPERTY_REFERENCE 'public final additionalText: kotlin.Int [delegated,val]' field=null getter='public final fun (): kotlin.Int declared in ' setter=null type=kotlin.reflect.KProperty<*> origin=PROPERTY_REFERENCE_FOR_DELEGATE <1>: PROPERTY name:additionalValue visibility:public modality:FINAL [delegated,val] FIELD PROPERTY_DELEGATE name:additionalValue$delegate type:.DVal visibility:private [final,static] @@ -94,7 +94,7 @@ FILE fqName: fileName:/genericPropertyRef.kt CALL 'public final fun getValue (t: kotlin.Any?, p: kotlin.Any): kotlin.Int [operator] declared in .DVal' type=kotlin.Int origin=null $this: GET_FIELD 'FIELD PROPERTY_DELEGATE name:additionalValue$delegate type:.DVal visibility:private [final,static]' type=.DVal origin=null t: ERROR_CALL 'Unresolved reference: this@R|/additionalValue|' type=.Value.> - p: PROPERTY_REFERENCE 'public final additionalValue: kotlin.Int [delegated,val]' field=null getter='public final fun (): kotlin.Int declared in ' setter=null type=kotlin.reflect.KProperty<*> origin=null + p: PROPERTY_REFERENCE 'public final additionalValue: kotlin.Int [delegated,val]' field=null getter='public final fun (): kotlin.Int declared in ' setter=null type=kotlin.reflect.KProperty<*> origin=PROPERTY_REFERENCE_FOR_DELEGATE <1>: CLASS CLASS name:DVal modality:FINAL visibility:public superTypes:[kotlin.Any] $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.DVal diff --git a/compiler/testData/ir/irText/expressions/propertyReferences.fir.txt b/compiler/testData/ir/irText/expressions/propertyReferences.fir.txt index 8a211a2a1cf..e34a2c7eb17 100644 --- a/compiler/testData/ir/irText/expressions/propertyReferences.fir.txt +++ b/compiler/testData/ir/irText/expressions/propertyReferences.fir.txt @@ -199,7 +199,7 @@ FILE fqName: fileName:/propertyReferences.kt CALL 'public final fun getValue (thisRef: kotlin.Any?, kProp: kotlin.Any): kotlin.Int [operator] declared in .Delegate' type=kotlin.Int origin=null $this: GET_FIELD 'FIELD PROPERTY_DELEGATE name:delegatedVal$delegate type:.Delegate visibility:private [final,static]' type=.Delegate origin=null thisRef: CONST Null type=kotlin.Nothing? value=null - kProp: PROPERTY_REFERENCE 'public final delegatedVal: kotlin.Int [delegated,val]' field=null getter='public final fun (): kotlin.Int declared in ' setter=null type=kotlin.reflect.KProperty<*> origin=null + kProp: PROPERTY_REFERENCE 'public final delegatedVal: kotlin.Int [delegated,val]' field=null getter='public final fun (): kotlin.Int declared in ' setter=null type=kotlin.reflect.KProperty<*> origin=PROPERTY_REFERENCE_FOR_DELEGATE PROPERTY name:test_delegatedVal visibility:public modality:FINAL [val] FIELD PROPERTY_BACKING_FIELD name:test_delegatedVal type:kotlin.reflect.KProperty0 visibility:private [final,static] EXPRESSION_BODY @@ -220,7 +220,7 @@ FILE fqName: fileName:/propertyReferences.kt CALL 'public final fun getValue (thisRef: kotlin.Any?, kProp: kotlin.Any): kotlin.Int [operator] declared in .Delegate' type=kotlin.Int origin=null $this: GET_FIELD 'FIELD PROPERTY_DELEGATE name:delegatedVar$delegate type:.Delegate visibility:private [final,static]' type=.Delegate origin=null thisRef: CONST Null type=kotlin.Nothing? value=null - kProp: PROPERTY_REFERENCE 'public final delegatedVar: kotlin.Int [delegated,var]' field=null getter='public final fun (): kotlin.Int declared in ' setter='public final fun (: kotlin.Int): kotlin.Unit declared in ' type=kotlin.reflect.KProperty<*> origin=null + kProp: PROPERTY_REFERENCE 'public final delegatedVar: kotlin.Int [delegated,var]' field=null getter='public final fun (): kotlin.Int declared in ' setter='public final fun (: kotlin.Int): kotlin.Unit declared in ' type=kotlin.reflect.KProperty<*> origin=PROPERTY_REFERENCE_FOR_DELEGATE FUN DELEGATED_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> (:kotlin.Int) returnType:kotlin.Unit correspondingProperty: PROPERTY name:delegatedVar visibility:public modality:FINAL [delegated,var] VALUE_PARAMETER name: index:0 type:kotlin.Int @@ -228,7 +228,7 @@ FILE fqName: fileName:/propertyReferences.kt CALL 'public final fun setValue (thisRef: kotlin.Any?, kProp: kotlin.Any, value: kotlin.Int): kotlin.Unit [operator] declared in .Delegate' type=kotlin.Unit origin=null $this: GET_FIELD 'FIELD PROPERTY_DELEGATE name:delegatedVar$delegate type:.Delegate visibility:private [final,static]' type=.Delegate origin=null thisRef: CONST Null type=kotlin.Nothing? value=null - kProp: PROPERTY_REFERENCE 'public final delegatedVar: kotlin.Int [delegated,var]' field=null getter='public final fun (): kotlin.Int declared in ' setter='public final fun (: kotlin.Int): kotlin.Unit declared in ' type=kotlin.reflect.KProperty<*> origin=null + kProp: PROPERTY_REFERENCE 'public final delegatedVar: kotlin.Int [delegated,var]' field=null getter='public final fun (): kotlin.Int declared in ' setter='public final fun (: kotlin.Int): kotlin.Unit declared in ' type=kotlin.reflect.KProperty<*> origin=PROPERTY_REFERENCE_FOR_DELEGATE value: GET_VAR ': kotlin.Int declared in .' type=kotlin.Int origin=null PROPERTY name:test_delegatedVar visibility:public modality:FINAL [val] FIELD PROPERTY_BACKING_FIELD name:test_delegatedVar type:kotlin.reflect.KMutableProperty0 visibility:private [final,static] diff --git a/compiler/testData/ir/irText/types/genericDelegatedDeepProperty.fir.txt b/compiler/testData/ir/irText/types/genericDelegatedDeepProperty.fir.txt index 6c2ce4eacfe..a742954a310 100644 --- a/compiler/testData/ir/irText/types/genericDelegatedDeepProperty.fir.txt +++ b/compiler/testData/ir/irText/types/genericDelegatedDeepProperty.fir.txt @@ -263,7 +263,7 @@ FILE fqName: fileName:/genericDelegatedDeepProperty.kt CALL 'public final fun getValue (t: .Value., .CR.>>, p: kotlin.reflect.KProperty<*>): T of . declared in .additionalText$delegate..deepO$delegate.' type=T of . origin=null $this: GET_FIELD 'FIELD PROPERTY_DELEGATE name:deepO$delegate type:.additionalText$delegate..deepO$delegate. visibility:private [final]' type=.additionalText$delegate..deepO$delegate. origin=null t: ERROR_CALL 'Unresolved reference: this@R|/anonymous.deepO|' type=.Value., .CR.>> - p: PROPERTY_REFERENCE 'private final deepO: T of . [delegated,val]' field=null getter='public final fun (): T of . declared in .additionalText$delegate.' setter=null type=kotlin.reflect.KProperty<*> origin=null + p: PROPERTY_REFERENCE 'private final deepO: T of . [delegated,val]' field=null getter='public final fun (): T of . declared in .additionalText$delegate.' setter=null type=kotlin.reflect.KProperty<*> origin=PROPERTY_REFERENCE_FOR_DELEGATE PROPERTY name:deepK visibility:private modality:FINAL [delegated,val] FIELD PROPERTY_DELEGATE name:deepK$delegate type:.additionalText$delegate..deepK$delegate. visibility:private [final] EXPRESSION_BODY @@ -293,7 +293,7 @@ FILE fqName: fileName:/genericDelegatedDeepProperty.kt CALL 'public final fun getValue (t: .Value., .CR.>>, p: kotlin.reflect.KProperty<*>): T of . declared in .additionalText$delegate..deepK$delegate.' type=T of . origin=null $this: GET_FIELD 'FIELD PROPERTY_DELEGATE name:deepK$delegate type:.additionalText$delegate..deepK$delegate. visibility:private [final]' type=.additionalText$delegate..deepK$delegate. origin=null t: ERROR_CALL 'Unresolved reference: this@R|/anonymous.deepK|' type=.Value., .CR.>> - p: PROPERTY_REFERENCE 'private final deepK: T of . [delegated,val]' field=null getter='public final fun (): T of . declared in .additionalText$delegate.' setter=null type=kotlin.reflect.KProperty<*> origin=null + p: PROPERTY_REFERENCE 'private final deepK: T of . [delegated,val]' field=null getter='public final fun (): T of . declared in .additionalText$delegate.' setter=null type=kotlin.reflect.KProperty<*> origin=PROPERTY_REFERENCE_FOR_DELEGATE FUN name:getValue visibility:public modality:FINAL <> ($this:.additionalText$delegate., t:.Value., .CR.>>, p:kotlin.reflect.KProperty<*>) returnType:.P., T of .> $this: VALUE_PARAMETER name: type:.additionalText$delegate. VALUE_PARAMETER name:t index:0 type:.Value., .CR.>> @@ -319,5 +319,5 @@ FILE fqName: fileName:/genericDelegatedDeepProperty.kt CALL 'public final fun getValue (t: .Value., .CR.>>, p: kotlin.reflect.KProperty<*>): .P., T of .> declared in .additionalText$delegate.' type=.P., T of .> origin=null $this: GET_FIELD 'FIELD PROPERTY_DELEGATE name:additionalText$delegate type:.additionalText$delegate. visibility:private [final,static]' type=.additionalText$delegate. origin=null t: ERROR_CALL 'Unresolved reference: this@R|/additionalText|' type=.Value., .CR.>> - p: PROPERTY_REFERENCE 'public final additionalText: .P., T of .> [delegated,val]' field=null getter='public final fun (): .P., T of .> declared in ' setter=null type=kotlin.reflect.KProperty<*> origin=null + p: PROPERTY_REFERENCE 'public final additionalText: .P., T of .> [delegated,val]' field=null getter='public final fun (): .P., T of .> declared in ' setter=null type=kotlin.reflect.KProperty<*> origin=PROPERTY_REFERENCE_FOR_DELEGATE <1>: