From 46fccae7d170942c07a8669d33a17c9f7fe15c85 Mon Sep 17 00:00:00 2001 From: Dmitry Petrov Date: Thu, 30 Jul 2020 13:18:36 +0300 Subject: [PATCH] PSI2IR: KT-40499 Fix delegated property desugaring No type arguments were provided for property reference inside delegated property accessors. --- .../kotlin/fir/Fir2IrTextTestGenerated.java | 5 ++ .../generators/DelegatedPropertyGenerator.kt | 37 +++++---- .../genericDelegatedProperty.fir.txt | 80 ++++++++++++++++++ .../declarations/genericDelegatedProperty.kt | 8 ++ .../declarations/genericDelegatedProperty.txt | 81 +++++++++++++++++++ .../irText/expressions/genericPropertyRef.txt | 2 + .../types/genericDelegatedDeepProperty.txt | 1 + .../kotlin/ir/IrTextTestCaseGenerated.java | 5 ++ 8 files changed, 200 insertions(+), 19 deletions(-) create mode 100644 compiler/testData/ir/irText/declarations/genericDelegatedProperty.fir.txt create mode 100644 compiler/testData/ir/irText/declarations/genericDelegatedProperty.kt create mode 100644 compiler/testData/ir/irText/declarations/genericDelegatedProperty.txt diff --git a/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/fir/Fir2IrTextTestGenerated.java b/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/fir/Fir2IrTextTestGenerated.java index 6d512872353..7b7b1a0e1a8 100644 --- a/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/fir/Fir2IrTextTestGenerated.java +++ b/compiler/fir/fir2ir/tests/org/jetbrains/kotlin/fir/Fir2IrTextTestGenerated.java @@ -314,6 +314,11 @@ public class Fir2IrTextTestGenerated extends AbstractFir2IrTextTest { runTest("compiler/testData/ir/irText/declarations/fileWithTypeAliasesOnly.kt"); } + @TestMetadata("genericDelegatedProperty.kt") + public void testGenericDelegatedProperty() throws Exception { + runTest("compiler/testData/ir/irText/declarations/genericDelegatedProperty.kt"); + } + @TestMetadata("interfaceProperties.kt") public void testInterfaceProperties() throws Exception { runTest("compiler/testData/ir/irText/declarations/interfaceProperties.kt"); diff --git a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/DelegatedPropertyGenerator.kt b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/DelegatedPropertyGenerator.kt index a5cdfce8777..637ca4722da 100644 --- a/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/DelegatedPropertyGenerator.kt +++ b/compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/generators/DelegatedPropertyGenerator.kt @@ -62,6 +62,7 @@ class DelegatedPropertyGenerator(declarationGenerator: DeclarationGenerator) : D val irDelegate = irProperty.backingField!! + val propertyTypeArguments = propertyDescriptor.typeParameters.associateWith { it.defaultType } val thisClass = propertyDescriptor.containingDeclaration as? ClassDescriptor val delegateReceiverValue = createBackingFieldValueForDelegate(irDelegate.symbol, thisClass, ktDelegate, propertyDescriptor) val getterDescriptor = propertyDescriptor.getter!! @@ -69,7 +70,7 @@ class DelegatedPropertyGenerator(declarationGenerator: DeclarationGenerator) : D generateDelegatedPropertyGetterBody( irGetter, ktDelegate, getterDescriptor, delegateReceiverValue, - createCallableReference(ktDelegate, kPropertyType, propertyDescriptor, irGetter.symbol) + createPropertyReference(ktDelegate, kPropertyType, propertyDescriptor, irGetter.symbol, propertyTypeArguments) ) } @@ -79,7 +80,7 @@ class DelegatedPropertyGenerator(declarationGenerator: DeclarationGenerator) : D generateDelegatedPropertySetterBody( irSetter, ktDelegate, setterDescriptor, delegateReceiverValue, - createCallableReference(ktDelegate, kPropertyType, propertyDescriptor, irSetter.symbol) + createPropertyReference(ktDelegate, kPropertyType, propertyDescriptor, irSetter.symbol, propertyTypeArguments) ) } } @@ -161,7 +162,12 @@ class DelegatedPropertyGenerator(declarationGenerator: DeclarationGenerator) : D val statementGenerator = createBodyGenerator(scopeOwner).createStatementGenerator() val provideDelegateCall = statementGenerator.pregenerateCall(provideDelegateResolvedCall) provideDelegateCall.setExplicitReceiverValue(OnceExpressionValue(irDelegateInitializer.expression)) - provideDelegateCall.irValueArgumentsByIndex[1] = createCallableReference(ktDelegate, kPropertyType, property, scopeOwner) + provideDelegateCall.irValueArgumentsByIndex[1] = + createPropertyReference( + ktDelegate, kPropertyType, property, scopeOwner, + null // we don't know type arguments at this time; see also KT-24643. + ) + val irProvideDelegate = CallGenerator(statementGenerator).generateCall( ktDelegate.startOffsetSkippingComments, ktDelegate.endOffset, provideDelegateCall ) @@ -200,27 +206,20 @@ class DelegatedPropertyGenerator(declarationGenerator: DeclarationGenerator) : D } } - private fun createCallableReference( - ktElement: KtElement, - type: KotlinType, - referencedDescriptor: CallableDescriptor, - statementGenerator: StatementGenerator - ): IrCallableReference<*> = - ReflectionReferencesGenerator(statementGenerator).generateCallableReference( - ktElement, type, - referencedDescriptor, - null, IrStatementOrigin.PROPERTY_REFERENCE_FOR_DELEGATE - ) - - private fun createCallableReference( + private fun createPropertyReference( ktElement: KtElement, type: KotlinType, referencedDescriptor: VariableDescriptorWithAccessors, - scopeOwner: IrSymbol + scopeOwner: IrSymbol, + typeArguments: Map? ): IrCallableReference<*> = - createCallableReference( - ktElement, type, referencedDescriptor, + ReflectionReferencesGenerator( createBodyGenerator(scopeOwner).createStatementGenerator() + ).generateCallableReference( + ktElement, type, + referencedDescriptor, + typeArguments, + IrStatementOrigin.PROPERTY_REFERENCE_FOR_DELEGATE ) private fun createLocalDelegatedPropertyReference( diff --git a/compiler/testData/ir/irText/declarations/genericDelegatedProperty.fir.txt b/compiler/testData/ir/irText/declarations/genericDelegatedProperty.fir.txt new file mode 100644 index 00000000000..ef60d86f2f4 --- /dev/null +++ b/compiler/testData/ir/irText/declarations/genericDelegatedProperty.fir.txt @@ -0,0 +1,80 @@ +FILE fqName: fileName:/genericDelegatedProperty.kt + CLASS CLASS name:C modality:FINAL visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.C.C> + TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?] + CONSTRUCTOR visibility:public <> () returnType:.C.C> [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:C modality:FINAL visibility:public superTypes:[kotlin.Any]' + 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 + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS OBJECT name:Delegate modality:FINAL visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Delegate + CONSTRUCTOR visibility:private <> () returnType:.Delegate [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS OBJECT name:Delegate modality:FINAL visibility:public superTypes:[kotlin.Any]' + FUN name:getValue visibility:public modality:FINAL <> ($this:.Delegate, thisRef:kotlin.Any?, kProp:kotlin.Any?) returnType:kotlin.Int [operator] + $this: VALUE_PARAMETER name: type:.Delegate + VALUE_PARAMETER name:thisRef index:0 type:kotlin.Any? + VALUE_PARAMETER name:kProp index:1 type:kotlin.Any? + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun getValue (thisRef: kotlin.Any?, kProp: kotlin.Any?): kotlin.Int [operator] declared in .Delegate' + CONST Int type=kotlin.Int value=42 + FUN name:setValue visibility:public modality:FINAL <> ($this:.Delegate, thisRef:kotlin.Any?, kProp:kotlin.Any?, newValue:kotlin.Int) returnType:kotlin.Unit [operator] + $this: VALUE_PARAMETER name: type:.Delegate + VALUE_PARAMETER name:thisRef index:0 type:kotlin.Any? + VALUE_PARAMETER name:kProp index:1 type:kotlin.Any? + VALUE_PARAMETER name:newValue index:2 type:kotlin.Int + BLOCK_BODY + 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 + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + PROPERTY name:genericDelegatedProperty visibility:public modality:FINAL [delegated,var] + FIELD PROPERTY_DELEGATE name:genericDelegatedProperty$delegate type:.Delegate visibility:private [final,static] + EXPRESSION_BODY + GET_OBJECT 'CLASS OBJECT name:Delegate modality:FINAL visibility:public superTypes:[kotlin.Any]' type=.Delegate + FUN DELEGATED_PROPERTY_ACCESSOR name: visibility:public modality:FINAL ($receiver:.C.>) returnType:kotlin.Int + correspondingProperty: PROPERTY name:genericDelegatedProperty visibility:public modality:FINAL [delegated,var] + TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?] + $receiver: VALUE_PARAMETER name: type:.C.> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (): kotlin.Int declared in ' + 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:genericDelegatedProperty$delegate type:.Delegate visibility:private [final,static]' type=.Delegate origin=null + thisRef: GET_VAR ': .C.> declared in .' type=.C.> origin=null + kProp: PROPERTY_REFERENCE 'public final genericDelegatedProperty: 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.KMutableProperty1<.C.>, kotlin.Int> origin=PROPERTY_REFERENCE_FOR_DELEGATE + <1>: + FUN DELEGATED_PROPERTY_ACCESSOR name: visibility:public modality:FINAL ($receiver:.C.>, :kotlin.Int) returnType:kotlin.Unit + correspondingProperty: PROPERTY name:genericDelegatedProperty visibility:public modality:FINAL [delegated,var] + TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?] + $receiver: VALUE_PARAMETER name: type:.C.> + VALUE_PARAMETER name: index:0 type:kotlin.Int + BLOCK_BODY + CALL 'public final fun setValue (thisRef: kotlin.Any?, kProp: kotlin.Any?, newValue: kotlin.Int): kotlin.Unit [operator] declared in .Delegate' type=kotlin.Unit origin=null + $this: GET_FIELD 'FIELD PROPERTY_DELEGATE name:genericDelegatedProperty$delegate type:.Delegate visibility:private [final,static]' type=.Delegate origin=null + thisRef: GET_VAR ': .C.> declared in .' type=.C.> origin=null + kProp: PROPERTY_REFERENCE 'public final genericDelegatedProperty: 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.KMutableProperty1<.C.>, kotlin.Int> origin=PROPERTY_REFERENCE_FOR_DELEGATE + <1>: + newValue: GET_VAR ': kotlin.Int declared in .' type=kotlin.Int origin=null diff --git a/compiler/testData/ir/irText/declarations/genericDelegatedProperty.kt b/compiler/testData/ir/irText/declarations/genericDelegatedProperty.kt new file mode 100644 index 00000000000..e90261c217c --- /dev/null +++ b/compiler/testData/ir/irText/declarations/genericDelegatedProperty.kt @@ -0,0 +1,8 @@ +class C + +object Delegate { + operator fun getValue(thisRef: Any?, kProp: Any?) = 42 + operator fun setValue(thisRef: Any?, kProp: Any? , newValue: Int) {} +} + +var C.genericDelegatedProperty by Delegate \ No newline at end of file diff --git a/compiler/testData/ir/irText/declarations/genericDelegatedProperty.txt b/compiler/testData/ir/irText/declarations/genericDelegatedProperty.txt new file mode 100644 index 00000000000..b3367c710ef --- /dev/null +++ b/compiler/testData/ir/irText/declarations/genericDelegatedProperty.txt @@ -0,0 +1,81 @@ +FILE fqName: fileName:/genericDelegatedProperty.kt + CLASS CLASS name:C modality:FINAL visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.C.C> + TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?] + CONSTRUCTOR visibility:public <> () returnType:.C.C> [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:C modality:FINAL visibility:public superTypes:[kotlin.Any]' + 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 + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS OBJECT name:Delegate modality:FINAL visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Delegate + CONSTRUCTOR visibility:private <> () returnType:.Delegate [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS OBJECT name:Delegate modality:FINAL visibility:public superTypes:[kotlin.Any]' + FUN name:getValue visibility:public modality:FINAL <> ($this:.Delegate, thisRef:kotlin.Any?, kProp:kotlin.Any?) returnType:kotlin.Int [operator] + $this: VALUE_PARAMETER name: type:.Delegate + VALUE_PARAMETER name:thisRef index:0 type:kotlin.Any? + VALUE_PARAMETER name:kProp index:1 type:kotlin.Any? + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun getValue (thisRef: kotlin.Any?, kProp: kotlin.Any?): kotlin.Int [operator] declared in .Delegate' + CONST Int type=kotlin.Int value=42 + FUN name:setValue visibility:public modality:FINAL <> ($this:.Delegate, thisRef:kotlin.Any?, kProp:kotlin.Any?, newValue:kotlin.Int) returnType:kotlin.Unit [operator] + $this: VALUE_PARAMETER name: type:.Delegate + VALUE_PARAMETER name:thisRef index:0 type:kotlin.Any? + VALUE_PARAMETER name:kProp index:1 type:kotlin.Any? + VALUE_PARAMETER name:newValue index:2 type:kotlin.Int + BLOCK_BODY + 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 + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + PROPERTY name:genericDelegatedProperty visibility:public modality:FINAL [delegated,var] + FIELD PROPERTY_DELEGATE name:genericDelegatedProperty$delegate type:.Delegate visibility:private [final,static] + EXPRESSION_BODY + GET_OBJECT 'CLASS OBJECT name:Delegate modality:FINAL visibility:public superTypes:[kotlin.Any]' type=.Delegate + FUN DELEGATED_PROPERTY_ACCESSOR name: visibility:public modality:FINAL ($receiver:.C.>) returnType:kotlin.Int + correspondingProperty: PROPERTY name:genericDelegatedProperty visibility:public modality:FINAL [delegated,var] + TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?] + $receiver: VALUE_PARAMETER name: type:.C.> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (): kotlin.Int declared in ' + 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:genericDelegatedProperty$delegate type:.Delegate visibility:private [final,static]' type=.Delegate origin=null + thisRef: GET_VAR ': .C.> declared in .' type=.C.> origin=null + kProp: PROPERTY_REFERENCE 'public final genericDelegatedProperty: 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.KMutableProperty1<.C.>, kotlin.Int> origin=PROPERTY_REFERENCE_FOR_DELEGATE + <1>: T of . + FUN DELEGATED_PROPERTY_ACCESSOR name: visibility:public modality:FINAL ($receiver:.C.>, :kotlin.Int) returnType:kotlin.Unit + correspondingProperty: PROPERTY name:genericDelegatedProperty visibility:public modality:FINAL [delegated,var] + TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?] + $receiver: VALUE_PARAMETER name: type:.C.> + VALUE_PARAMETER name: index:0 type:kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (: kotlin.Int): kotlin.Unit declared in ' + CALL 'public final fun setValue (thisRef: kotlin.Any?, kProp: kotlin.Any?, newValue: kotlin.Int): kotlin.Unit [operator] declared in .Delegate' type=kotlin.Unit origin=null + $this: GET_FIELD 'FIELD PROPERTY_DELEGATE name:genericDelegatedProperty$delegate type:.Delegate visibility:private [final,static]' type=.Delegate origin=null + thisRef: GET_VAR ': .C.> declared in .' type=.C.> origin=null + kProp: PROPERTY_REFERENCE 'public final genericDelegatedProperty: 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.KMutableProperty1<.C.>, kotlin.Int> origin=PROPERTY_REFERENCE_FOR_DELEGATE + <1>: T of . + newValue: GET_VAR ': kotlin.Int declared in .' type=kotlin.Int origin=null diff --git a/compiler/testData/ir/irText/expressions/genericPropertyRef.txt b/compiler/testData/ir/irText/expressions/genericPropertyRef.txt index c04cbbefafd..c33d2427fc1 100644 --- a/compiler/testData/ir/irText/expressions/genericPropertyRef.txt +++ b/compiler/testData/ir/irText/expressions/genericPropertyRef.txt @@ -79,6 +79,7 @@ FILE fqName: fileName:/genericPropertyRef.kt $this: GET_FIELD 'FIELD PROPERTY_DELEGATE name:additionalText$delegate type:.DVal visibility:private [final,static]' type=.DVal origin=null t: GET_VAR ': .Value.> declared in .' type=.Value.> 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.KProperty1<.Value.>, kotlin.Int> origin=PROPERTY_REFERENCE_FOR_DELEGATE + <1>: T of . PROPERTY name:additionalValue visibility:public modality:FINAL [delegated,val] FIELD PROPERTY_DELEGATE name:additionalValue$delegate type:.DVal visibility:private [final,static] EXPRESSION_BODY @@ -94,6 +95,7 @@ FILE fqName: fileName:/genericPropertyRef.kt $this: GET_FIELD 'FIELD PROPERTY_DELEGATE name:additionalValue$delegate type:.DVal visibility:private [final,static]' type=.DVal origin=null t: GET_VAR ': .Value.> declared in .' type=.Value.> 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.KProperty1<.Value.>, kotlin.Int> origin=PROPERTY_REFERENCE_FOR_DELEGATE + <1>: T of . CLASS CLASS name:DVal modality:FINAL visibility:public superTypes:[kotlin.Any] $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.DVal CONSTRUCTOR visibility:public <> (kmember:kotlin.Any) returnType:.DVal [primary] diff --git a/compiler/testData/ir/irText/types/genericDelegatedDeepProperty.txt b/compiler/testData/ir/irText/types/genericDelegatedDeepProperty.txt index 4a84da0a93e..56a5e1fb95f 100644 --- a/compiler/testData/ir/irText/types/genericDelegatedDeepProperty.txt +++ b/compiler/testData/ir/irText/types/genericDelegatedDeepProperty.txt @@ -377,3 +377,4 @@ FILE fqName: fileName:/genericDelegatedDeepProperty.kt $this: GET_FIELD 'FIELD PROPERTY_DELEGATE name:additionalText$delegate type:.additionalText$delegate. visibility:private [final,static]' type=.additionalText$delegate. origin=null t: GET_VAR ': .Value., .CR.>> declared in .' type=.Value., .CR.>> 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.KProperty1<.Value., .CR.>>, .P., T of .>> origin=PROPERTY_REFERENCE_FOR_DELEGATE + <1>: T of . diff --git a/compiler/tests/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java b/compiler/tests/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java index 18da02b3c04..bfc36cf569c 100644 --- a/compiler/tests/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java @@ -313,6 +313,11 @@ public class IrTextTestCaseGenerated extends AbstractIrTextTestCase { runTest("compiler/testData/ir/irText/declarations/fileWithTypeAliasesOnly.kt"); } + @TestMetadata("genericDelegatedProperty.kt") + public void testGenericDelegatedProperty() throws Exception { + runTest("compiler/testData/ir/irText/declarations/genericDelegatedProperty.kt"); + } + @TestMetadata("interfaceProperties.kt") public void testInterfaceProperties() throws Exception { runTest("compiler/testData/ir/irText/declarations/interfaceProperties.kt");