diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrDeclarationStorage.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrDeclarationStorage.kt index 1b2734c6a2b..a7477b4911c 100644 --- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrDeclarationStorage.kt +++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrDeclarationStorage.kt @@ -19,11 +19,13 @@ import org.jetbrains.kotlin.fir.descriptors.FirModuleDescriptor import org.jetbrains.kotlin.fir.descriptors.FirPackageFragmentDescriptor import org.jetbrains.kotlin.fir.expressions.FirConstExpression import org.jetbrains.kotlin.fir.expressions.FirExpression +import org.jetbrains.kotlin.fir.expressions.FirQualifiedAccess import org.jetbrains.kotlin.fir.expressions.impl.FirExpressionStub import org.jetbrains.kotlin.fir.lazy.Fir2IrLazyClass import org.jetbrains.kotlin.fir.lazy.Fir2IrLazyConstructor import org.jetbrains.kotlin.fir.lazy.Fir2IrLazyProperty import org.jetbrains.kotlin.fir.lazy.Fir2IrLazySimpleFunction +import org.jetbrains.kotlin.fir.references.FirResolvedNamedReference import org.jetbrains.kotlin.fir.resolve.firProvider import org.jetbrains.kotlin.fir.resolve.firSymbolProvider import org.jetbrains.kotlin.fir.resolve.inference.isSuspendFunctionType @@ -739,6 +741,12 @@ class Fir2IrDeclarationStorage( containingClass: ConeClassLikeLookupTag? = null, ): IrProperty { classifierStorage.preCacheTypeParameters(property) + if (property.delegate != null) { + val delegateReference = (property.delegate as? FirQualifiedAccess)?.calleeReference as? FirResolvedNamedReference + (delegateReference?.resolvedSymbol?.fir as? FirTypeParameterRefsOwner)?.let { + classifierStorage.preCacheTypeParameters(it) + } + } val signature = if (isLocal) null else signatureComposer.composeSignature(property, containingClass) return property.convertWithOffsets { startOffset, endOffset -> val result = declareIrProperty(signature, property.containerSource) { symbol -> diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/fir/Fir2IrTextTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/fir/Fir2IrTextTestGenerated.java index f57fcdafeaa..a64bda8ea61 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/fir/Fir2IrTextTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/fir/Fir2IrTextTestGenerated.java @@ -1848,6 +1848,11 @@ public class Fir2IrTextTestGenerated extends AbstractFir2IrTextTest { runTest("compiler/testData/ir/irText/firProblems/putIfAbsent.kt"); } + @TestMetadata("readWriteProperty.kt") + public void testReadWriteProperty() throws Exception { + runTest("compiler/testData/ir/irText/firProblems/readWriteProperty.kt"); + } + @TestMetadata("recursiveCapturedTypeInPropertyReference.kt") public void testRecursiveCapturedTypeInPropertyReference() throws Exception { runTest("compiler/testData/ir/irText/firProblems/recursiveCapturedTypeInPropertyReference.kt"); diff --git a/compiler/testData/ir/irText/firProblems/readWriteProperty.fir.kt.txt b/compiler/testData/ir/irText/firProblems/readWriteProperty.fir.kt.txt new file mode 100644 index 00000000000..72f6380c202 --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/readWriteProperty.fir.kt.txt @@ -0,0 +1,76 @@ +class SettingType { + constructor(type: KClass) /* primary */ { + super/*Any*/() + /* () */ + + } + + val type: KClass + field = type + get + +} + +class SettingReference> { + constructor(t: T, v: V) /* primary */ { + super/*Any*/() + /* () */ + + } + + var t: T + field = t + get + set + + var v: V + field = v + get + set + +} + +class IdeWizard { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + var projectTemplate: Int? /* by */ + field = .setting>(reference = SettingReference>(t = SettingType(type = 42::class), v = 42)) + get(): Int? { + return .#projectTemplate$delegate.getValue(thisRef = , property = IdeWizard::projectTemplate) + } + set(: Int?) { + .#projectTemplate$delegate.setValue(thisRef = , property = IdeWizard::projectTemplate, value = ) + } + + private fun > setting(reference: SettingReference): { + return { // BLOCK + local class : ReadWriteProperty { + private constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + override operator fun setValue(thisRef: Any?, property: KProperty<*>, value: V?) { + when { + EQEQ(arg0 = value, arg1 = null) -> return Unit + } + reference.( = SettingType(type = value /*as V */::class) as T) + reference.( = value /*as V */) + } + + override operator fun getValue(thisRef: Any?, property: KProperty<*>): V? { + return reference.() + } + + } + + () + } + } + +} diff --git a/compiler/testData/ir/irText/firProblems/readWriteProperty.fir.txt b/compiler/testData/ir/irText/firProblems/readWriteProperty.fir.txt new file mode 100644 index 00000000000..c7de57617e9 --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/readWriteProperty.fir.txt @@ -0,0 +1,214 @@ +FILE fqName: fileName:/readWriteProperty.kt + CLASS CLASS name:SettingType modality:FINAL visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.SettingType.SettingType> + TYPE_PARAMETER name:V index:0 variance:out superTypes:[kotlin.Any] + CONSTRUCTOR visibility:public <> (type:kotlin.reflect.KClass.SettingType>) returnType:.SettingType.SettingType> [primary] + VALUE_PARAMETER name:type index:0 type:kotlin.reflect.KClass.SettingType> + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:SettingType modality:FINAL visibility:public superTypes:[kotlin.Any]' + PROPERTY name:type visibility:public modality:FINAL [val] + FIELD PROPERTY_BACKING_FIELD name:type type:kotlin.reflect.KClass.SettingType> visibility:private [final] + EXPRESSION_BODY + GET_VAR 'type: kotlin.reflect.KClass.SettingType> declared in .SettingType.' type=kotlin.reflect.KClass.SettingType> origin=INITIALIZE_PROPERTY_FROM_PARAMETER + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.SettingType.SettingType>) returnType:kotlin.reflect.KClass.SettingType> + correspondingProperty: PROPERTY name:type visibility:public modality:FINAL [val] + $this: VALUE_PARAMETER name: type:.SettingType.SettingType> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (): kotlin.reflect.KClass.SettingType> declared in .SettingType' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:type type:kotlin.reflect.KClass.SettingType> visibility:private [final]' type=kotlin.reflect.KClass.SettingType> origin=null + receiver: GET_VAR ': .SettingType.SettingType> declared in .SettingType.' type=.SettingType.SettingType> origin=null + 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 CLASS name:SettingReference modality:FINAL visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.SettingReference.SettingReference, T of .SettingReference> + TYPE_PARAMETER name:V index:0 variance: superTypes:[kotlin.Any] + TYPE_PARAMETER name:T index:1 variance: superTypes:[.SettingType.SettingReference>] + CONSTRUCTOR visibility:public <> (t:T of .SettingReference, v:V of .SettingReference) returnType:.SettingReference.SettingReference, T of .SettingReference> [primary] + VALUE_PARAMETER name:t index:0 type:T of .SettingReference + VALUE_PARAMETER name:v index:1 type:V of .SettingReference + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:SettingReference modality:FINAL visibility:public superTypes:[kotlin.Any]' + PROPERTY name:t visibility:public modality:FINAL [var] + FIELD PROPERTY_BACKING_FIELD name:t type:T of .SettingReference visibility:private + EXPRESSION_BODY + GET_VAR 't: T of .SettingReference declared in .SettingReference.' type=T of .SettingReference origin=INITIALIZE_PROPERTY_FROM_PARAMETER + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.SettingReference.SettingReference, T of .SettingReference>) returnType:T of .SettingReference + correspondingProperty: PROPERTY name:t visibility:public modality:FINAL [var] + $this: VALUE_PARAMETER name: type:.SettingReference.SettingReference, T of .SettingReference> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (): T of .SettingReference declared in .SettingReference' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:t type:T of .SettingReference visibility:private' type=T of .SettingReference origin=null + receiver: GET_VAR ': .SettingReference.SettingReference, T of .SettingReference> declared in .SettingReference.' type=.SettingReference.SettingReference, T of .SettingReference> origin=null + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.SettingReference.SettingReference, T of .SettingReference>, :T of .SettingReference) returnType:kotlin.Unit + correspondingProperty: PROPERTY name:t visibility:public modality:FINAL [var] + $this: VALUE_PARAMETER name: type:.SettingReference.SettingReference, T of .SettingReference> + VALUE_PARAMETER name: index:0 type:T of .SettingReference + BLOCK_BODY + SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:t type:T of .SettingReference visibility:private' type=kotlin.Unit origin=null + receiver: GET_VAR ': .SettingReference.SettingReference, T of .SettingReference> declared in .SettingReference.' type=.SettingReference.SettingReference, T of .SettingReference> origin=null + value: GET_VAR ': T of .SettingReference declared in .SettingReference.' type=T of .SettingReference origin=null + PROPERTY name:v visibility:public modality:FINAL [var] + FIELD PROPERTY_BACKING_FIELD name:v type:V of .SettingReference visibility:private + EXPRESSION_BODY + GET_VAR 'v: V of .SettingReference declared in .SettingReference.' type=V of .SettingReference origin=INITIALIZE_PROPERTY_FROM_PARAMETER + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.SettingReference.SettingReference, T of .SettingReference>) returnType:V of .SettingReference + correspondingProperty: PROPERTY name:v visibility:public modality:FINAL [var] + $this: VALUE_PARAMETER name: type:.SettingReference.SettingReference, T of .SettingReference> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (): V of .SettingReference declared in .SettingReference' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:v type:V of .SettingReference visibility:private' type=V of .SettingReference origin=null + receiver: GET_VAR ': .SettingReference.SettingReference, T of .SettingReference> declared in .SettingReference.' type=.SettingReference.SettingReference, T of .SettingReference> origin=null + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.SettingReference.SettingReference, T of .SettingReference>, :V of .SettingReference) returnType:kotlin.Unit + correspondingProperty: PROPERTY name:v visibility:public modality:FINAL [var] + $this: VALUE_PARAMETER name: type:.SettingReference.SettingReference, T of .SettingReference> + VALUE_PARAMETER name: index:0 type:V of .SettingReference + BLOCK_BODY + SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:v type:V of .SettingReference visibility:private' type=kotlin.Unit origin=null + receiver: GET_VAR ': .SettingReference.SettingReference, T of .SettingReference> declared in .SettingReference.' type=.SettingReference.SettingReference, T of .SettingReference> origin=null + value: GET_VAR ': V of .SettingReference declared in .SettingReference.' type=V of .SettingReference origin=null + 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 CLASS name:IdeWizard modality:FINAL visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.IdeWizard + CONSTRUCTOR visibility:public <> () returnType:.IdeWizard [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:IdeWizard modality:FINAL visibility:public superTypes:[kotlin.Any]' + PROPERTY name:projectTemplate visibility:public modality:FINAL [delegated,var] + FIELD PROPERTY_DELEGATE name:projectTemplate$delegate type:.IdeWizard.setting..SettingType> visibility:private [final] + EXPRESSION_BODY + CALL 'private final fun setting (reference: .SettingReference.IdeWizard.setting, T of .IdeWizard.setting>): .IdeWizard.setting..IdeWizard.setting, T of .IdeWizard.setting> declared in .IdeWizard' type=.IdeWizard.setting..SettingType> origin=null + : kotlin.Int + : .SettingType + $this: GET_VAR ': .IdeWizard declared in .IdeWizard' type=.IdeWizard origin=null + reference: CONSTRUCTOR_CALL 'public constructor (t: T of .SettingReference, v: V of .SettingReference) [primary] declared in .SettingReference' type=.SettingReference.SettingType> origin=null + : kotlin.Int + : .SettingType + t: CONSTRUCTOR_CALL 'public constructor (type: kotlin.reflect.KClass.SettingType>) [primary] declared in .SettingType' type=.SettingType origin=null + : kotlin.Int + type: GET_CLASS type=kotlin.reflect.KClass + CONST Int type=kotlin.Int value=42 + v: CONST Int type=kotlin.Int value=42 + FUN DELEGATED_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.IdeWizard) returnType:kotlin.Int? + correspondingProperty: PROPERTY name:projectTemplate visibility:public modality:FINAL [delegated,var] + $this: VALUE_PARAMETER name: type:.IdeWizard + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (): kotlin.Int? declared in .IdeWizard' + CALL 'public final fun getValue (thisRef: kotlin.Any?, property: kotlin.reflect.KProperty<*>): V of .IdeWizard.setting? [operator] declared in .IdeWizard.setting.' type=kotlin.Int? origin=null + $this: GET_FIELD 'FIELD PROPERTY_DELEGATE name:projectTemplate$delegate type:.IdeWizard.setting..SettingType> visibility:private [final]' type=.IdeWizard.setting..SettingType> origin=null + receiver: GET_VAR ': .IdeWizard declared in .IdeWizard.' type=.IdeWizard origin=null + thisRef: GET_VAR ': .IdeWizard declared in .IdeWizard.' type=.IdeWizard origin=null + property: PROPERTY_REFERENCE 'public final projectTemplate: kotlin.Int? [delegated,var]' field=null getter='public final fun (): kotlin.Int? declared in .IdeWizard' setter='public final fun (: kotlin.Int?): kotlin.Unit declared in .IdeWizard' type=kotlin.reflect.KMutableProperty1<.IdeWizard, kotlin.Int?> origin=PROPERTY_REFERENCE_FOR_DELEGATE + FUN DELEGATED_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.IdeWizard, :kotlin.Int?) returnType:kotlin.Unit + correspondingProperty: PROPERTY name:projectTemplate visibility:public modality:FINAL [delegated,var] + $this: VALUE_PARAMETER name: type:.IdeWizard + VALUE_PARAMETER name: index:0 type:kotlin.Int? + BLOCK_BODY + CALL 'public final fun setValue (thisRef: kotlin.Any?, property: kotlin.reflect.KProperty<*>, value: V of .IdeWizard.setting?): kotlin.Unit [operator] declared in .IdeWizard.setting.' type=kotlin.Unit origin=null + $this: GET_FIELD 'FIELD PROPERTY_DELEGATE name:projectTemplate$delegate type:.IdeWizard.setting..SettingType> visibility:private [final]' type=.IdeWizard.setting..SettingType> origin=null + receiver: GET_VAR ': .IdeWizard declared in .IdeWizard.' type=.IdeWizard origin=null + thisRef: GET_VAR ': .IdeWizard declared in .IdeWizard.' type=.IdeWizard origin=null + property: PROPERTY_REFERENCE 'public final projectTemplate: kotlin.Int? [delegated,var]' field=null getter='public final fun (): kotlin.Int? declared in .IdeWizard' setter='public final fun (: kotlin.Int?): kotlin.Unit declared in .IdeWizard' type=kotlin.reflect.KMutableProperty1<.IdeWizard, kotlin.Int?> origin=PROPERTY_REFERENCE_FOR_DELEGATE + value: GET_VAR ': kotlin.Int? declared in .IdeWizard.' type=kotlin.Int? origin=null + FUN name:setting visibility:private modality:FINAL ($this:.IdeWizard, reference:.SettingReference.IdeWizard.setting, T of .IdeWizard.setting>) returnType:.IdeWizard.setting..IdeWizard.setting, T of .IdeWizard.setting> + TYPE_PARAMETER name:V index:0 variance: superTypes:[kotlin.Any] + TYPE_PARAMETER name:T index:1 variance: superTypes:[.SettingType.IdeWizard.setting>] + $this: VALUE_PARAMETER name: type:.IdeWizard + VALUE_PARAMETER name:reference index:0 type:.SettingReference.IdeWizard.setting, T of .IdeWizard.setting> + BLOCK_BODY + RETURN type=kotlin.Nothing from='private final fun setting (reference: .SettingReference.IdeWizard.setting, T of .IdeWizard.setting>): .IdeWizard.setting..IdeWizard.setting, T of .IdeWizard.setting> declared in .IdeWizard' + BLOCK type=.IdeWizard.setting..IdeWizard.setting, T of .IdeWizard.setting> origin=OBJECT_LITERAL + CLASS CLASS name: modality:FINAL visibility:local superTypes:[kotlin.properties.ReadWriteProperty.IdeWizard.setting?>] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.IdeWizard.setting..IdeWizard.setting, T of .IdeWizard.setting> + CONSTRUCTOR visibility:private <> () returnType:.IdeWizard.setting..IdeWizard.setting, T of .IdeWizard.setting> [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name: modality:FINAL visibility:local superTypes:[kotlin.properties.ReadWriteProperty.IdeWizard.setting?>]' + FUN name:setValue visibility:public modality:FINAL <> ($this:.IdeWizard.setting..IdeWizard.setting, T of .IdeWizard.setting>, thisRef:kotlin.Any?, property:kotlin.reflect.KProperty<*>, value:V of .IdeWizard.setting?) returnType:kotlin.Unit [operator] + overridden: + public abstract fun setValue (thisRef: T of kotlin.properties.ReadWriteProperty, property: kotlin.reflect.KProperty<*>, value: V of kotlin.properties.ReadWriteProperty): kotlin.Unit [operator] declared in kotlin.properties.ReadWriteProperty + $this: VALUE_PARAMETER name: type:.IdeWizard.setting..IdeWizard.setting, T of .IdeWizard.setting> + VALUE_PARAMETER name:thisRef index:0 type:kotlin.Any? + VALUE_PARAMETER name:property index:1 type:kotlin.reflect.KProperty<*> + VALUE_PARAMETER name:value index:2 type:V of .IdeWizard.setting? + BLOCK_BODY + WHEN type=kotlin.Unit origin=IF + BRANCH + if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ + arg0: GET_VAR 'value: V of .IdeWizard.setting? declared in .IdeWizard.setting..setValue' type=V of .IdeWizard.setting? origin=null + arg1: CONST Null type=kotlin.Nothing? value=null + then: RETURN type=kotlin.Nothing from='public final fun setValue (thisRef: kotlin.Any?, property: kotlin.reflect.KProperty<*>, value: V of .IdeWizard.setting?): kotlin.Unit [operator] declared in .IdeWizard.setting.' + GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit + CALL 'public final fun (: T of .SettingReference): kotlin.Unit declared in .SettingReference' type=kotlin.Unit origin=EQ + $this: GET_VAR 'reference: .SettingReference.IdeWizard.setting, T of .IdeWizard.setting> declared in .IdeWizard.setting' type=.SettingReference.IdeWizard.setting, T of .IdeWizard.setting> origin=null + : TYPE_OP type=T of .IdeWizard.setting origin=CAST typeOperand=T of .IdeWizard.setting + CONSTRUCTOR_CALL 'public constructor (type: kotlin.reflect.KClass.SettingType>) [primary] declared in .SettingType' type=.SettingType.IdeWizard.setting> origin=null + : V of .IdeWizard.setting + type: GET_CLASS type=kotlin.reflect.KClass.IdeWizard.setting> + TYPE_OP type=V of .IdeWizard.setting origin=IMPLICIT_CAST typeOperand=V of .IdeWizard.setting + GET_VAR 'value: V of .IdeWizard.setting? declared in .IdeWizard.setting..setValue' type=V of .IdeWizard.setting? origin=null + CALL 'public final fun (: V of .SettingReference): kotlin.Unit declared in .SettingReference' type=kotlin.Unit origin=EQ + $this: GET_VAR 'reference: .SettingReference.IdeWizard.setting, T of .IdeWizard.setting> declared in .IdeWizard.setting' type=.SettingReference.IdeWizard.setting, T of .IdeWizard.setting> origin=null + : TYPE_OP type=V of .IdeWizard.setting origin=IMPLICIT_CAST typeOperand=V of .IdeWizard.setting + GET_VAR 'value: V of .IdeWizard.setting? declared in .IdeWizard.setting..setValue' type=V of .IdeWizard.setting? origin=null + FUN name:getValue visibility:public modality:FINAL <> ($this:.IdeWizard.setting..IdeWizard.setting, T of .IdeWizard.setting>, thisRef:kotlin.Any?, property:kotlin.reflect.KProperty<*>) returnType:V of .IdeWizard.setting? [operator] + overridden: + public abstract fun getValue (thisRef: T of kotlin.properties.ReadWriteProperty, property: kotlin.reflect.KProperty<*>): V of kotlin.properties.ReadWriteProperty [operator] declared in kotlin.properties.ReadWriteProperty + $this: VALUE_PARAMETER name: type:.IdeWizard.setting..IdeWizard.setting, T of .IdeWizard.setting> + VALUE_PARAMETER name:thisRef index:0 type:kotlin.Any? + VALUE_PARAMETER name:property index:1 type:kotlin.reflect.KProperty<*> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun getValue (thisRef: kotlin.Any?, property: kotlin.reflect.KProperty<*>): V of .IdeWizard.setting? [operator] declared in .IdeWizard.setting.' + CALL 'public final fun (): V of .SettingReference declared in .SettingReference' type=V of .IdeWizard.setting origin=GET_PROPERTY + $this: GET_VAR 'reference: .SettingReference.IdeWizard.setting, T of .IdeWizard.setting> declared in .IdeWizard.setting' type=.SettingReference.IdeWizard.setting, T of .IdeWizard.setting> origin=null + 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 + CONSTRUCTOR_CALL 'private constructor () [primary] declared in .IdeWizard.setting.' type=.IdeWizard.setting..IdeWizard.setting, T of .IdeWizard.setting> origin=OBJECT_LITERAL + 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 diff --git a/compiler/testData/ir/irText/firProblems/readWriteProperty.kt b/compiler/testData/ir/irText/firProblems/readWriteProperty.kt new file mode 100644 index 00000000000..a75e4444bad --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/readWriteProperty.kt @@ -0,0 +1,32 @@ +// WITH_RUNTIME +// WITH_REFLECT + +import kotlin.properties.ReadWriteProperty +import kotlin.reflect.KClass +import kotlin.reflect.KProperty + +class SettingType( + val type : KClass +) + +class SettingReference>( + var t : T + var v : V +) + +class IdeWizard { + var projectTemplate by setting(SettingReference(SettingType(42::class), 42)) + + private fun > setting(reference: SettingReference) = + object : ReadWriteProperty { + override fun setValue(thisRef: Any?, property: KProperty<*>, value: V?) { + if (value == null) return + reference.t = SettingType(value::class) as T + reference.v = value + } + + override fun getValue(thisRef: Any?, property: KProperty<*>): V? { + return reference.v + } + } +} diff --git a/compiler/testData/ir/irText/firProblems/readWriteProperty.kt.txt b/compiler/testData/ir/irText/firProblems/readWriteProperty.kt.txt new file mode 100644 index 00000000000..895e9c43fc1 --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/readWriteProperty.kt.txt @@ -0,0 +1,76 @@ +class SettingType { + constructor(type: KClass) /* primary */ { + super/*Any*/() + /* () */ + + } + + val type: KClass + field = type + get + +} + +class SettingReference> { + constructor(t: T, v: V) /* primary */ { + super/*Any*/() + /* () */ + + } + + var t: T + field = t + get + set + + var v: V + field = v + get + set + +} + +class IdeWizard { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + var projectTemplate: Int? /* by */ + field = .setting>(reference = SettingReference>(t = SettingType(type = 42::class), v = 42)) + get(): Int? { + return .#projectTemplate$delegate.getValue(thisRef = , property = IdeWizard::projectTemplate) + } + set(: Int?) { + return .#projectTemplate$delegate.setValue(thisRef = , property = IdeWizard::projectTemplate, value = ) + } + + private fun > setting(reference: SettingReference): { + return { // BLOCK + local class : ReadWriteProperty { + constructor() /* primary */ { + super/*Any*/() + /* () */ + + } + + override operator fun setValue(thisRef: Any?, property: KProperty<*>, value: V?) { + when { + EQEQ(arg0 = value, arg1 = null) -> return Unit + } + reference.( = SettingType(type = value::class) as T) + reference.( = value) + } + + override operator fun getValue(thisRef: Any?, property: KProperty<*>): V? { + return reference.() + } + + } + + () + } + } + +} diff --git a/compiler/testData/ir/irText/firProblems/readWriteProperty.txt b/compiler/testData/ir/irText/firProblems/readWriteProperty.txt new file mode 100644 index 00000000000..6d558213b76 --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/readWriteProperty.txt @@ -0,0 +1,213 @@ +FILE fqName: fileName:/readWriteProperty.kt + CLASS CLASS name:SettingType modality:FINAL visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.SettingType.SettingType> + TYPE_PARAMETER name:V index:0 variance:out superTypes:[kotlin.Any] + CONSTRUCTOR visibility:public <> (type:kotlin.reflect.KClass.SettingType>) returnType:.SettingType.SettingType> [primary] + VALUE_PARAMETER name:type index:0 type:kotlin.reflect.KClass.SettingType> + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:SettingType modality:FINAL visibility:public superTypes:[kotlin.Any]' + PROPERTY name:type visibility:public modality:FINAL [val] + FIELD PROPERTY_BACKING_FIELD name:type type:kotlin.reflect.KClass.SettingType> visibility:private [final] + EXPRESSION_BODY + GET_VAR 'type: kotlin.reflect.KClass.SettingType> declared in .SettingType.' type=kotlin.reflect.KClass.SettingType> origin=INITIALIZE_PROPERTY_FROM_PARAMETER + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.SettingType.SettingType>) returnType:kotlin.reflect.KClass.SettingType> + correspondingProperty: PROPERTY name:type visibility:public modality:FINAL [val] + $this: VALUE_PARAMETER name: type:.SettingType.SettingType> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (): kotlin.reflect.KClass.SettingType> declared in .SettingType' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:type type:kotlin.reflect.KClass.SettingType> visibility:private [final]' type=kotlin.reflect.KClass.SettingType> origin=null + receiver: GET_VAR ': .SettingType.SettingType> declared in .SettingType.' type=.SettingType.SettingType> origin=null + 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 CLASS name:SettingReference modality:FINAL visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.SettingReference.SettingReference, T of .SettingReference> + TYPE_PARAMETER name:V index:0 variance: superTypes:[kotlin.Any] + TYPE_PARAMETER name:T index:1 variance: superTypes:[.SettingType.SettingReference>] + CONSTRUCTOR visibility:public <> (t:T of .SettingReference, v:V of .SettingReference) returnType:.SettingReference.SettingReference, T of .SettingReference> [primary] + VALUE_PARAMETER name:t index:0 type:T of .SettingReference + VALUE_PARAMETER name:v index:1 type:V of .SettingReference + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:SettingReference modality:FINAL visibility:public superTypes:[kotlin.Any]' + PROPERTY name:t visibility:public modality:FINAL [var] + FIELD PROPERTY_BACKING_FIELD name:t type:T of .SettingReference visibility:private + EXPRESSION_BODY + GET_VAR 't: T of .SettingReference declared in .SettingReference.' type=T of .SettingReference origin=INITIALIZE_PROPERTY_FROM_PARAMETER + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.SettingReference.SettingReference, T of .SettingReference>) returnType:T of .SettingReference + correspondingProperty: PROPERTY name:t visibility:public modality:FINAL [var] + $this: VALUE_PARAMETER name: type:.SettingReference.SettingReference, T of .SettingReference> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (): T of .SettingReference declared in .SettingReference' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:t type:T of .SettingReference visibility:private' type=T of .SettingReference origin=null + receiver: GET_VAR ': .SettingReference.SettingReference, T of .SettingReference> declared in .SettingReference.' type=.SettingReference.SettingReference, T of .SettingReference> origin=null + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.SettingReference.SettingReference, T of .SettingReference>, :T of .SettingReference) returnType:kotlin.Unit + correspondingProperty: PROPERTY name:t visibility:public modality:FINAL [var] + $this: VALUE_PARAMETER name: type:.SettingReference.SettingReference, T of .SettingReference> + VALUE_PARAMETER name: index:0 type:T of .SettingReference + BLOCK_BODY + SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:t type:T of .SettingReference visibility:private' type=kotlin.Unit origin=null + receiver: GET_VAR ': .SettingReference.SettingReference, T of .SettingReference> declared in .SettingReference.' type=.SettingReference.SettingReference, T of .SettingReference> origin=null + value: GET_VAR ': T of .SettingReference declared in .SettingReference.' type=T of .SettingReference origin=null + PROPERTY name:v visibility:public modality:FINAL [var] + FIELD PROPERTY_BACKING_FIELD name:v type:V of .SettingReference visibility:private + EXPRESSION_BODY + GET_VAR 'v: V of .SettingReference declared in .SettingReference.' type=V of .SettingReference origin=INITIALIZE_PROPERTY_FROM_PARAMETER + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.SettingReference.SettingReference, T of .SettingReference>) returnType:V of .SettingReference + correspondingProperty: PROPERTY name:v visibility:public modality:FINAL [var] + $this: VALUE_PARAMETER name: type:.SettingReference.SettingReference, T of .SettingReference> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (): V of .SettingReference declared in .SettingReference' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:v type:V of .SettingReference visibility:private' type=V of .SettingReference origin=null + receiver: GET_VAR ': .SettingReference.SettingReference, T of .SettingReference> declared in .SettingReference.' type=.SettingReference.SettingReference, T of .SettingReference> origin=null + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.SettingReference.SettingReference, T of .SettingReference>, :V of .SettingReference) returnType:kotlin.Unit + correspondingProperty: PROPERTY name:v visibility:public modality:FINAL [var] + $this: VALUE_PARAMETER name: type:.SettingReference.SettingReference, T of .SettingReference> + VALUE_PARAMETER name: index:0 type:V of .SettingReference + BLOCK_BODY + SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:v type:V of .SettingReference visibility:private' type=kotlin.Unit origin=null + receiver: GET_VAR ': .SettingReference.SettingReference, T of .SettingReference> declared in .SettingReference.' type=.SettingReference.SettingReference, T of .SettingReference> origin=null + value: GET_VAR ': V of .SettingReference declared in .SettingReference.' type=V of .SettingReference origin=null + 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 CLASS name:IdeWizard modality:FINAL visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.IdeWizard + CONSTRUCTOR visibility:public <> () returnType:.IdeWizard [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:IdeWizard modality:FINAL visibility:public superTypes:[kotlin.Any]' + PROPERTY name:projectTemplate visibility:public modality:FINAL [delegated,var] + FIELD PROPERTY_DELEGATE name:projectTemplate$delegate type:.IdeWizard.setting..SettingType> visibility:private [final] + EXPRESSION_BODY + CALL 'private final fun setting (reference: .SettingReference.IdeWizard.setting, T of .IdeWizard.setting>): .IdeWizard.setting..IdeWizard.setting, T of .IdeWizard.setting> declared in .IdeWizard' type=.IdeWizard.setting..SettingType> origin=null + : kotlin.Int + : .SettingType + $this: GET_VAR ': .IdeWizard declared in .IdeWizard' type=.IdeWizard origin=null + reference: CONSTRUCTOR_CALL 'public constructor (t: T of .SettingReference, v: V of .SettingReference) [primary] declared in .SettingReference' type=.SettingReference.SettingType> origin=null + : kotlin.Int + : .SettingType + t: CONSTRUCTOR_CALL 'public constructor (type: kotlin.reflect.KClass.SettingType>) [primary] declared in .SettingType' type=.SettingType origin=null + : kotlin.Int + type: GET_CLASS type=kotlin.reflect.KClass + CONST Int type=kotlin.Int value=42 + v: CONST Int type=kotlin.Int value=42 + FUN DELEGATED_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.IdeWizard) returnType:kotlin.Int? + correspondingProperty: PROPERTY name:projectTemplate visibility:public modality:FINAL [delegated,var] + $this: VALUE_PARAMETER name: type:.IdeWizard + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (): kotlin.Int? declared in .IdeWizard' + CALL 'public open fun getValue (thisRef: kotlin.Any?, property: kotlin.reflect.KProperty<*>): V of .IdeWizard.setting? [operator] declared in .IdeWizard.setting.' type=kotlin.Int? origin=null + $this: GET_FIELD 'FIELD PROPERTY_DELEGATE name:projectTemplate$delegate type:.IdeWizard.setting..SettingType> visibility:private [final]' type=.IdeWizard.setting..SettingType> origin=null + receiver: GET_VAR ': .IdeWizard declared in .IdeWizard.' type=.IdeWizard origin=null + thisRef: GET_VAR ': .IdeWizard declared in .IdeWizard.' type=.IdeWizard origin=null + property: PROPERTY_REFERENCE 'public final projectTemplate: kotlin.Int? [delegated,var]' field=null getter='public final fun (): kotlin.Int? declared in .IdeWizard' setter='public final fun (: kotlin.Int?): kotlin.Unit declared in .IdeWizard' type=kotlin.reflect.KMutableProperty1<.IdeWizard, kotlin.Int?> origin=PROPERTY_REFERENCE_FOR_DELEGATE + FUN DELEGATED_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.IdeWizard, :kotlin.Int?) returnType:kotlin.Unit + correspondingProperty: PROPERTY name:projectTemplate visibility:public modality:FINAL [delegated,var] + $this: VALUE_PARAMETER name: type:.IdeWizard + VALUE_PARAMETER name: index:0 type:kotlin.Int? + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (: kotlin.Int?): kotlin.Unit declared in .IdeWizard' + CALL 'public open fun setValue (thisRef: kotlin.Any?, property: kotlin.reflect.KProperty<*>, value: V of .IdeWizard.setting?): kotlin.Unit [operator] declared in .IdeWizard.setting.' type=kotlin.Unit origin=null + $this: GET_FIELD 'FIELD PROPERTY_DELEGATE name:projectTemplate$delegate type:.IdeWizard.setting..SettingType> visibility:private [final]' type=.IdeWizard.setting..SettingType> origin=null + receiver: GET_VAR ': .IdeWizard declared in .IdeWizard.' type=.IdeWizard origin=null + thisRef: GET_VAR ': .IdeWizard declared in .IdeWizard.' type=.IdeWizard origin=null + property: PROPERTY_REFERENCE 'public final projectTemplate: kotlin.Int? [delegated,var]' field=null getter='public final fun (): kotlin.Int? declared in .IdeWizard' setter='public final fun (: kotlin.Int?): kotlin.Unit declared in .IdeWizard' type=kotlin.reflect.KMutableProperty1<.IdeWizard, kotlin.Int?> origin=PROPERTY_REFERENCE_FOR_DELEGATE + value: GET_VAR ': kotlin.Int? declared in .IdeWizard.' type=kotlin.Int? origin=null + FUN name:setting visibility:private modality:FINAL ($this:.IdeWizard, reference:.SettingReference.IdeWizard.setting, T of .IdeWizard.setting>) returnType:.IdeWizard.setting..IdeWizard.setting, T of .IdeWizard.setting> + TYPE_PARAMETER name:V index:0 variance: superTypes:[kotlin.Any] + TYPE_PARAMETER name:T index:1 variance: superTypes:[.SettingType.IdeWizard.setting>] + $this: VALUE_PARAMETER name: type:.IdeWizard + VALUE_PARAMETER name:reference index:0 type:.SettingReference.IdeWizard.setting, T of .IdeWizard.setting> + BLOCK_BODY + RETURN type=kotlin.Nothing from='private final fun setting (reference: .SettingReference.IdeWizard.setting, T of .IdeWizard.setting>): .IdeWizard.setting..IdeWizard.setting, T of .IdeWizard.setting> declared in .IdeWizard' + BLOCK type=.IdeWizard.setting..IdeWizard.setting, T of .IdeWizard.setting> origin=OBJECT_LITERAL + CLASS CLASS name: modality:FINAL visibility:local superTypes:[kotlin.properties.ReadWriteProperty.IdeWizard.setting?>] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.IdeWizard.setting..IdeWizard.setting, T of .IdeWizard.setting> + CONSTRUCTOR visibility:public <> () returnType:.IdeWizard.setting..IdeWizard.setting, T of .IdeWizard.setting> [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name: modality:FINAL visibility:local superTypes:[kotlin.properties.ReadWriteProperty.IdeWizard.setting?>]' + FUN name:setValue visibility:public modality:OPEN <> ($this:.IdeWizard.setting..IdeWizard.setting, T of .IdeWizard.setting>, thisRef:kotlin.Any?, property:kotlin.reflect.KProperty<*>, value:V of .IdeWizard.setting?) returnType:kotlin.Unit [operator] + overridden: + public abstract fun setValue (thisRef: T of kotlin.properties.ReadWriteProperty, property: kotlin.reflect.KProperty<*>, value: V of kotlin.properties.ReadWriteProperty): kotlin.Unit [operator] declared in kotlin.properties.ReadWriteProperty + $this: VALUE_PARAMETER name: type:.IdeWizard.setting..IdeWizard.setting, T of .IdeWizard.setting> + VALUE_PARAMETER name:thisRef index:0 type:kotlin.Any? + VALUE_PARAMETER name:property index:1 type:kotlin.reflect.KProperty<*> + VALUE_PARAMETER name:value index:2 type:V of .IdeWizard.setting? + BLOCK_BODY + WHEN type=kotlin.Unit origin=IF + BRANCH + if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ + arg0: GET_VAR 'value: V of .IdeWizard.setting? declared in .IdeWizard.setting..setValue' type=V of .IdeWizard.setting? origin=null + arg1: CONST Null type=kotlin.Nothing? value=null + then: RETURN type=kotlin.Nothing from='public open fun setValue (thisRef: kotlin.Any?, property: kotlin.reflect.KProperty<*>, value: V of .IdeWizard.setting?): kotlin.Unit [operator] declared in .IdeWizard.setting.' + GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit + CALL 'public final fun (: T of .SettingReference): kotlin.Unit declared in .SettingReference' type=kotlin.Unit origin=EQ + $this: GET_VAR 'reference: .SettingReference.IdeWizard.setting, T of .IdeWizard.setting> declared in .IdeWizard.setting' type=.SettingReference.IdeWizard.setting, T of .IdeWizard.setting> origin=null + : TYPE_OP type=T of .IdeWizard.setting origin=CAST typeOperand=T of .IdeWizard.setting + CONSTRUCTOR_CALL 'public constructor (type: kotlin.reflect.KClass.SettingType>) [primary] declared in .SettingType' type=.SettingType.IdeWizard.setting> origin=null + : V of .IdeWizard.setting + type: GET_CLASS type=kotlin.reflect.KClass.IdeWizard.setting> + GET_VAR 'value: V of .IdeWizard.setting? declared in .IdeWizard.setting..setValue' type=V of .IdeWizard.setting? origin=null + CALL 'public final fun (: V of .SettingReference): kotlin.Unit declared in .SettingReference' type=kotlin.Unit origin=EQ + $this: GET_VAR 'reference: .SettingReference.IdeWizard.setting, T of .IdeWizard.setting> declared in .IdeWizard.setting' type=.SettingReference.IdeWizard.setting, T of .IdeWizard.setting> origin=null + : GET_VAR 'value: V of .IdeWizard.setting? declared in .IdeWizard.setting..setValue' type=V of .IdeWizard.setting? origin=null + FUN name:getValue visibility:public modality:OPEN <> ($this:.IdeWizard.setting..IdeWizard.setting, T of .IdeWizard.setting>, thisRef:kotlin.Any?, property:kotlin.reflect.KProperty<*>) returnType:V of .IdeWizard.setting? [operator] + overridden: + public abstract fun getValue (thisRef: T of kotlin.properties.ReadWriteProperty, property: kotlin.reflect.KProperty<*>): V of kotlin.properties.ReadWriteProperty [operator] declared in kotlin.properties.ReadWriteProperty + $this: VALUE_PARAMETER name: type:.IdeWizard.setting..IdeWizard.setting, T of .IdeWizard.setting> + VALUE_PARAMETER name:thisRef index:0 type:kotlin.Any? + VALUE_PARAMETER name:property index:1 type:kotlin.reflect.KProperty<*> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun getValue (thisRef: kotlin.Any?, property: kotlin.reflect.KProperty<*>): V of .IdeWizard.setting? [operator] declared in .IdeWizard.setting.' + CALL 'public final fun (): V of .SettingReference declared in .SettingReference' type=V of .IdeWizard.setting origin=GET_PROPERTY + $this: GET_VAR 'reference: .SettingReference.IdeWizard.setting, T of .IdeWizard.setting> declared in .IdeWizard.setting' type=.SettingReference.IdeWizard.setting, T of .IdeWizard.setting> origin=null + 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 [fake_override,operator] declared in kotlin.properties.ReadWriteProperty + $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 [fake_override] declared in kotlin.properties.ReadWriteProperty + $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 [fake_override] declared in kotlin.properties.ReadWriteProperty + $this: VALUE_PARAMETER name: type:kotlin.Any + CONSTRUCTOR_CALL 'public constructor () [primary] declared in .IdeWizard.setting.' type=.IdeWizard.setting..IdeWizard.setting, T of .IdeWizard.setting> origin=OBJECT_LITERAL + 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 diff --git a/compiler/tests-gen/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java index c9d9cac3e7f..3e529ca8aaa 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java @@ -1847,6 +1847,11 @@ public class IrTextTestCaseGenerated extends AbstractIrTextTestCase { runTest("compiler/testData/ir/irText/firProblems/putIfAbsent.kt"); } + @TestMetadata("readWriteProperty.kt") + public void testReadWriteProperty() throws Exception { + runTest("compiler/testData/ir/irText/firProblems/readWriteProperty.kt"); + } + @TestMetadata("recursiveCapturedTypeInPropertyReference.kt") public void testRecursiveCapturedTypeInPropertyReference() throws Exception { runTest("compiler/testData/ir/irText/firProblems/recursiveCapturedTypeInPropertyReference.kt");