diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/ConversionUtils.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/ConversionUtils.kt index 12e7dd3eeb2..56d8ef04fda 100644 --- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/ConversionUtils.kt +++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/ConversionUtils.kt @@ -149,11 +149,9 @@ private fun FirCallableSymbol<*>.toSymbol(declarationStorage: Fir2IrDeclarationS } else { syntheticProperty.setter!!.delegate.symbol.toSymbol(declarationStorage, preferGetter) } - } ?: if (fir.isLocal) declarationStorage.getIrValueSymbol(this) else declarationStorage.getIrPropertyOrFieldSymbol(this) - } - is FirPropertySymbol -> { - if (fir.isLocal) declarationStorage.getIrValueSymbol(this) else declarationStorage.getIrPropertyOrFieldSymbol(this) + } ?: fir.toSymbol(declarationStorage) } + is FirPropertySymbol -> fir.toSymbol(declarationStorage) is FirFieldSymbol -> declarationStorage.getIrPropertyOrFieldSymbol(this) is FirBackingFieldSymbol -> declarationStorage.getIrBackingFieldSymbol(this) is FirDelegateFieldSymbol<*> -> declarationStorage.getIrBackingFieldSymbol(this) @@ -161,6 +159,12 @@ private fun FirCallableSymbol<*>.toSymbol(declarationStorage: Fir2IrDeclarationS else -> null } +private fun FirProperty.toSymbol(declarationStorage: Fir2IrDeclarationStorage): IrSymbol? = when { + !isLocal -> declarationStorage.getIrPropertyOrFieldSymbol(symbol) + delegate != null -> declarationStorage.getIrLocalDelegatedPropertySymbol(symbol) + else -> declarationStorage.getIrValueSymbol(symbol) +} + fun FirConstExpression<*>.getIrConstKind(): IrConstKind<*> = when (kind) { FirConstKind.IntegerLiteral -> { val type = typeRef.coneTypeUnsafe() 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 88f3dfbabdf..1a11578adfa 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 @@ -525,7 +525,7 @@ class Fir2IrDeclarationStorage( internal fun createIrPropertyAccessor( propertyAccessor: FirPropertyAccessor?, property: FirProperty, - correspondingProperty: IrProperty, + correspondingProperty: IrDeclarationWithName, propertyType: IrType, irParent: IrDeclarationParent?, thisReceiverOwner: IrClass? = irParent as? IrClass, @@ -537,7 +537,7 @@ class Fir2IrDeclarationStorage( ): IrSimpleFunction { val prefix = if (isSetter) "set" else "get" val signature = if (isLocal) null else signatureComposer.composeAccessorSignature(property, isSetter) - val containerSource = correspondingProperty.containerSource + val containerSource = (correspondingProperty as? IrProperty)?.containerSource return declareIrAccessor( signature, containerSource, @@ -550,8 +550,8 @@ class Fir2IrDeclarationStorage( irFactory.createFunction( startOffset, endOffset, origin, symbol, Name.special("<$prefix-${correspondingProperty.name}>"), - visibility ?: correspondingProperty.visibility, - correspondingProperty.modality, accessorReturnType, + visibility ?: (correspondingProperty as IrDeclarationWithVisibility).visibility, + (correspondingProperty as? IrOverridableMember)?.modality ?: Modality.FINAL, accessorReturnType, isInline = propertyAccessor?.isInline == true, isExternal = propertyAccessor?.isExternal == true, isTailrec = false, isSuspend = false, isOperator = false, @@ -559,7 +559,7 @@ class Fir2IrDeclarationStorage( isExpect = false, isFakeOverride = origin == IrDeclarationOrigin.FAKE_OVERRIDE, containerSource = containerSource, ).apply { - correspondingPropertySymbol = correspondingProperty.symbol + correspondingPropertySymbol = (correspondingProperty as? IrProperty)?.symbol if (propertyAccessor != null) { metadata = FirMetadataSource.Function(propertyAccessor) // Note that deserialized annotations are stored in the accessor, not the property. @@ -883,6 +883,41 @@ class Fir2IrDeclarationStorage( return irVariable } + fun createIrLocalDelegatedProperty(property: FirProperty, irParent: IrDeclarationParent): IrLocalDelegatedProperty { + val type = property.returnTypeRef.toIrType() + val origin = IrDeclarationOrigin.DEFINED + val irProperty = property.convertWithOffsets { startOffset, endOffset -> + val descriptor = WrappedVariableDescriptorWithAccessor() + symbolTable.declareLocalDelegatedProperty(startOffset, endOffset, origin, descriptor, type) { + irFactory.createLocalDelegatedProperty(startOffset, endOffset, origin, it, property.name, type, property.isVar).apply { + descriptor.bind(this) + } + } + }.apply { + parent = irParent + enterScope(this) + delegate = declareIrVariable( + startOffset, endOffset, IrDeclarationOrigin.PROPERTY_DELEGATE, + Name.identifier("${property.name}\$delegate"), property.delegate!!.typeRef.toIrType(), + isVar = false, isConst = false, isLateinit = false + ) + delegate.parent = irParent + getter = createIrPropertyAccessor( + property.getter, property, this, type, irParent, null, false, + IrDeclarationOrigin.DELEGATED_PROPERTY_ACCESSOR, startOffset, endOffset, isLocal + ) + if (property.isVar) { + setter = createIrPropertyAccessor( + property.setter, property, this, type, irParent, null, true, + IrDeclarationOrigin.DELEGATED_PROPERTY_ACCESSOR, startOffset, endOffset, isLocal + ) + } + leaveScope(this) + } + localStorage.putDelegatedProperty(property, irProperty) + return irProperty + } + fun declareTemporaryVariable(base: IrExpression, nameHint: String? = null): IrVariable { return declareIrVariable( base.startOffset, base.endOffset, IrDeclarationOrigin.IR_TEMPORARY_VARIABLE, @@ -1029,6 +1064,9 @@ class Fir2IrDeclarationStorage( fun getIrBackingFieldSymbol(firVariableSymbol: FirVariableSymbol<*>): IrSymbol { return when (val fir = firVariableSymbol.fir) { is FirProperty -> { + if (fir.isLocal) { + return localStorage.getDelegatedProperty(fir)?.delegate?.symbol ?: getIrVariableSymbol(fir) + } propertyCache[fir]?.let { return it.backingField!!.symbol } val irParent = findIrParent(fir) val parentOrigin = (irParent as? IrDeclaration)?.origin ?: IrDeclarationOrigin.DEFINED @@ -1047,6 +1085,11 @@ class Fir2IrDeclarationStorage( ?: throw IllegalArgumentException("Cannot find variable ${firVariable.render()} in local storage") } + fun getIrLocalDelegatedPropertySymbol(firPropertySymbol: FirPropertySymbol): IrSymbol { + return localStorage.getDelegatedProperty(firPropertySymbol.fir)?.symbol + ?: throw IllegalArgumentException("Cannot find delegated property ${firPropertySymbol.fir.render()} in local storage") + } + fun getIrValueSymbol(firVariableSymbol: FirVariableSymbol<*>): IrSymbol { return when (val firDeclaration = firVariableSymbol.fir) { is FirEnumEntry -> { diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrLocalStorage.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrLocalStorage.kt index ea710414f04..68039f8c03c 100644 --- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrLocalStorage.kt +++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrLocalStorage.kt @@ -6,10 +6,7 @@ package org.jetbrains.kotlin.fir.backend import org.jetbrains.kotlin.fir.declarations.* -import org.jetbrains.kotlin.ir.declarations.IrClass -import org.jetbrains.kotlin.ir.declarations.IrSimpleFunction -import org.jetbrains.kotlin.ir.declarations.IrValueParameter -import org.jetbrains.kotlin.ir.declarations.IrVariable +import org.jetbrains.kotlin.ir.declarations.* import org.jetbrains.kotlin.name.ClassId class Fir2IrLocalStorage { @@ -35,13 +32,8 @@ class Fir2IrLocalStorage { return null } - fun getVariable(variable: FirVariable<*>): IrVariable? { - for (cache in cacheStack.asReversed()) { - val local = cache.getVariable(variable) - if (local != null) return local - } - return null - } + fun getVariable(variable: FirVariable<*>): IrVariable? = + last { getVariable(variable) } fun getLocalClass(localClass: FirClass<*>): IrClass? { return localClassCache[localClass] @@ -51,10 +43,15 @@ class Fir2IrLocalStorage { return localClassCache.entries.find { (firClass, _) -> firClass.classId == classId }?.value } - fun getLocalFunction(localFunction: FirFunction<*>): IrSimpleFunction? { + fun getLocalFunction(localFunction: FirFunction<*>): IrSimpleFunction? = + last { getLocalFunction(localFunction) } + + fun getDelegatedProperty(property: FirProperty): IrLocalDelegatedProperty? = + last { getDelegatedProperty(property) } + + private inline fun last(getter: Fir2IrScopeCache.() -> T?): T? { for (cache in cacheStack.asReversed()) { - val local = cache.getLocalFunction(localFunction) - if (local != null) return local + cache.getter()?.let { return it } } return null } @@ -74,4 +71,8 @@ class Fir2IrLocalStorage { fun putLocalFunction(firFunction: FirFunction<*>, irFunction: IrSimpleFunction) { cacheStack.last().putLocalFunction(firFunction, irFunction) } + + fun putDelegatedProperty(firProperty: FirProperty, irProperty: IrLocalDelegatedProperty) { + cacheStack.last().putDelegatedProperty(firProperty, irProperty) + } } \ No newline at end of file diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrScopeCache.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrScopeCache.kt index c6f10e7c361..2fc8a5a4cc6 100644 --- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrScopeCache.kt +++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrScopeCache.kt @@ -7,6 +7,7 @@ package org.jetbrains.kotlin.fir.backend import org.jetbrains.kotlin.descriptors.Visibilities import org.jetbrains.kotlin.fir.declarations.* +import org.jetbrains.kotlin.ir.declarations.IrLocalDelegatedProperty import org.jetbrains.kotlin.ir.declarations.IrSimpleFunction import org.jetbrains.kotlin.ir.declarations.IrValueParameter import org.jetbrains.kotlin.ir.declarations.IrVariable @@ -18,6 +19,8 @@ class Fir2IrScopeCache { private val localFunctionCache = mutableMapOf, IrSimpleFunction>() + private val delegatedPropertyCache = mutableMapOf() + fun getParameter(parameter: FirValueParameter): IrValueParameter? = parameterCache[parameter] fun putParameter(firParameter: FirValueParameter, irParameter: IrValueParameter) { @@ -37,9 +40,16 @@ class Fir2IrScopeCache { localFunctionCache[localFunction] = irFunction } + fun getDelegatedProperty(property: FirProperty): IrLocalDelegatedProperty? = delegatedPropertyCache[property] + + fun putDelegatedProperty(firProperty: FirProperty, irProperty: IrLocalDelegatedProperty) { + delegatedPropertyCache[firProperty] = irProperty + } + fun clear() { parameterCache.clear() variableCache.clear() localFunctionCache.clear() + delegatedPropertyCache.clear() } } diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrVisitor.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrVisitor.kt index 0e48ff9f18a..32c5150ea21 100644 --- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrVisitor.kt +++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrVisitor.kt @@ -254,6 +254,20 @@ class Fir2IrVisitor( private fun visitLocalVariable(variable: FirProperty): IrElement { assert(variable.isLocal) + val delegate = variable.delegate + if (delegate != null) { + val irProperty = declarationStorage.createIrLocalDelegatedProperty(variable, conversionScope.parentFromStack()) + irProperty.delegate.initializer = convertToIrExpression(delegate) + conversionScope.withFunction(irProperty.getter) { + memberGenerator.convertFunctionContent(irProperty.getter, variable.getter, null) + } + irProperty.setter?.let { + conversionScope.withFunction(it) { + memberGenerator.convertFunctionContent(it, variable.setter, null) + } + } + return irProperty + } val initializer = variable.initializer val isNextVariable = initializer is FirFunctionCall && initializer.resolvedNamedFunctionSymbol()?.callableId?.isIteratorNext() == true && 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 5c87d18d55f..5d61f4b41bf 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 @@ -79,6 +79,15 @@ class CallAndReferenceGenerator( origin ) } + is IrLocalDelegatedPropertySymbol -> { + IrLocalDelegatedPropertyReferenceImpl( + startOffset, endOffset, type, symbol, + symbol.owner.delegate.symbol, + symbol.owner.getter.symbol as IrSimpleFunctionSymbol, + symbol.owner.setter?.symbol as IrSimpleFunctionSymbol?, + IrStatementOrigin.PROPERTY_REFERENCE_FOR_DELEGATE + ) + } is IrConstructorSymbol -> { val constructor = symbol.owner val klass = constructor.parent as? IrClass @@ -489,6 +498,15 @@ class CallAndReferenceGenerator( superQualifierSymbol = dispatchReceiver.superQualifierSymbol(symbol) ) } + is IrLocalDelegatedPropertySymbol -> { + IrCallImpl( + startOffset, endOffset, type, symbol.owner.getter.symbol as IrSimpleFunctionSymbol, + typeArgumentsCount = symbol.owner.getter.typeParameters.size, + valueArgumentsCount = 0, + origin = IrStatementOrigin.GET_LOCAL_PROPERTY, + superQualifierSymbol = dispatchReceiver.superQualifierSymbol(symbol) + ) + } is IrPropertySymbol -> { val getter = symbol.owner.getter val backingField = symbol.owner.backingField @@ -541,6 +559,21 @@ class CallAndReferenceGenerator( is IrFieldSymbol -> IrSetFieldImpl(startOffset, endOffset, symbol, type, origin).apply { value = assignedValue } + is IrLocalDelegatedPropertySymbol -> { + val setter = symbol.owner.setter + when { + setter != null -> IrCallImpl( + startOffset, endOffset, type, setter.symbol as IrSimpleFunctionSymbol, + typeArgumentsCount = setter.typeParameters.size, + valueArgumentsCount = 1, + origin = origin, + superQualifierSymbol = variableAssignment.dispatchReceiver.superQualifierSymbol(symbol) + ).apply { + putValueArgument(0, assignedValue) + } + else -> generateErrorCallExpression(startOffset, endOffset, calleeReference) + } + } is IrPropertySymbol -> { val irProperty = symbol.owner val setter = irProperty.setter diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/SymbolTable.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/SymbolTable.kt index ec11142afc3..a5ee822569a 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/SymbolTable.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/SymbolTable.kt @@ -966,17 +966,19 @@ class SymbolTable( endOffset: Int, origin: IrDeclarationOrigin, descriptor: VariableDescriptorWithAccessors, - type: IrType + type: IrType, + factory: (IrLocalDelegatedPropertySymbol) -> IrLocalDelegatedProperty = { + irFactory.createLocalDelegatedProperty( + startOffset, endOffset, origin, it, nameProvider.nameForDeclaration(descriptor), type, descriptor.isVar + ) + } ): IrLocalDelegatedProperty = localDelegatedPropertySymbolTable.declareLocal( descriptor, { IrLocalDelegatedPropertySymbolImpl(descriptor) }, - ) { - irFactory.createLocalDelegatedProperty( - startOffset, endOffset, origin, it, nameProvider.nameForDeclaration(descriptor), type, descriptor.isVar - ).apply { - metadata = MetadataSource.LocalDelegatedProperty(descriptor) - } + factory + ).apply { + metadata = MetadataSource.LocalDelegatedProperty(descriptor) } fun referenceLocalDelegatedProperty(descriptor: VariableDescriptorWithAccessors) = diff --git a/compiler/testData/codegen/box/controlStructures/forInArray/forInDelegatedPropertyUpdatedInLoopBody.kt b/compiler/testData/codegen/box/controlStructures/forInArray/forInDelegatedPropertyUpdatedInLoopBody.kt index 26fbe42fcc2..4807578c574 100644 --- a/compiler/testData/codegen/box/controlStructures/forInArray/forInDelegatedPropertyUpdatedInLoopBody.kt +++ b/compiler/testData/codegen/box/controlStructures/forInArray/forInDelegatedPropertyUpdatedInLoopBody.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR class Del(var x: T) { operator fun getValue(thisRef: Any?, kProp: Any) = x diff --git a/compiler/testData/codegen/box/coroutines/localDelegate.kt b/compiler/testData/codegen/box/coroutines/localDelegate.kt index 509cf87a7c5..b38dbf8d921 100644 --- a/compiler/testData/codegen/box/coroutines/localDelegate.kt +++ b/compiler/testData/codegen/box/coroutines/localDelegate.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR // WITH_RUNTIME // WITH_COROUTINES // COMMON_COROUTINES_TEST diff --git a/compiler/testData/codegen/box/delegatedProperty/kt37204.kt b/compiler/testData/codegen/box/delegatedProperty/kt37204.kt index a4aae28764b..26842f6d407 100644 --- a/compiler/testData/codegen/box/delegatedProperty/kt37204.kt +++ b/compiler/testData/codegen/box/delegatedProperty/kt37204.kt @@ -1,6 +1,5 @@ // WITH_RUNTIME // KJS_WITH_FULL_RUNTIME -// IGNORE_BACKEND_FIR: JVM_IR val log = StringBuilder() diff --git a/compiler/testData/codegen/box/delegatedProperty/local/capturedLocalVal.kt b/compiler/testData/codegen/box/delegatedProperty/local/capturedLocalVal.kt index 0ac324f3c0a..52a0de0cd68 100644 --- a/compiler/testData/codegen/box/delegatedProperty/local/capturedLocalVal.kt +++ b/compiler/testData/codegen/box/delegatedProperty/local/capturedLocalVal.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR package foo import kotlin.reflect.KProperty diff --git a/compiler/testData/codegen/box/delegatedProperty/local/capturedLocalValNoInline.kt b/compiler/testData/codegen/box/delegatedProperty/local/capturedLocalValNoInline.kt index 385e0c3414f..bb21f1e3b52 100644 --- a/compiler/testData/codegen/box/delegatedProperty/local/capturedLocalValNoInline.kt +++ b/compiler/testData/codegen/box/delegatedProperty/local/capturedLocalValNoInline.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR package foo import kotlin.reflect.KProperty diff --git a/compiler/testData/codegen/box/delegatedProperty/local/capturedLocalVar.kt b/compiler/testData/codegen/box/delegatedProperty/local/capturedLocalVar.kt index d655e965ab1..819a3afc3d6 100644 --- a/compiler/testData/codegen/box/delegatedProperty/local/capturedLocalVar.kt +++ b/compiler/testData/codegen/box/delegatedProperty/local/capturedLocalVar.kt @@ -14,7 +14,8 @@ class Delegate { fun box(): String { var prop: Int by Delegate() + if (prop != 1) return "fail get 1" run { prop = 2 } - if (prop != 2) return "fail get" - return run { if (prop != 2) "fail set" else "OK" } + if (prop != 2) return "fail get 2" + return run { if (prop != 2) "fail get 3" else "OK" } } diff --git a/compiler/testData/codegen/box/delegatedProperty/local/capturedLocalVarNoInline.kt b/compiler/testData/codegen/box/delegatedProperty/local/capturedLocalVarNoInline.kt index 8ac07a3f364..6dafeae6053 100644 --- a/compiler/testData/codegen/box/delegatedProperty/local/capturedLocalVarNoInline.kt +++ b/compiler/testData/codegen/box/delegatedProperty/local/capturedLocalVarNoInline.kt @@ -14,7 +14,8 @@ class Delegate { fun box(): String { var prop: Int by Delegate() + if (prop != 1) return "fail get 1" run { prop = 2 } - if (prop != 2) return "fail get" - return run { if (prop != 2) "fail set" else "OK" } + if (prop != 2) return "fail get 2" + return run { if (prop != 2) "fail get 3" else "OK" } } diff --git a/compiler/testData/codegen/box/delegatedProperty/local/inlineGetValue.kt b/compiler/testData/codegen/box/delegatedProperty/local/inlineGetValue.kt index 45c015acdc4..80a60fd6e61 100644 --- a/compiler/testData/codegen/box/delegatedProperty/local/inlineGetValue.kt +++ b/compiler/testData/codegen/box/delegatedProperty/local/inlineGetValue.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR package foo import kotlin.reflect.KProperty diff --git a/compiler/testData/codegen/box/delegatedProperty/local/inlineOperators.kt b/compiler/testData/codegen/box/delegatedProperty/local/inlineOperators.kt index d3147ecaa39..98198d4acd4 100644 --- a/compiler/testData/codegen/box/delegatedProperty/local/inlineOperators.kt +++ b/compiler/testData/codegen/box/delegatedProperty/local/inlineOperators.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR package foo import kotlin.reflect.KProperty diff --git a/compiler/testData/codegen/box/delegatedProperty/local/kt12891.kt b/compiler/testData/codegen/box/delegatedProperty/local/kt12891.kt index 150736964f9..683c4fca841 100644 --- a/compiler/testData/codegen/box/delegatedProperty/local/kt12891.kt +++ b/compiler/testData/codegen/box/delegatedProperty/local/kt12891.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR //WITH_RUNTIME fun box(): String { val x by lazy { "OK" } diff --git a/compiler/testData/codegen/box/delegatedProperty/local/kt16864.kt b/compiler/testData/codegen/box/delegatedProperty/local/kt16864.kt index 5625c363bdf..f5dedb6d76b 100644 --- a/compiler/testData/codegen/box/delegatedProperty/local/kt16864.kt +++ b/compiler/testData/codegen/box/delegatedProperty/local/kt16864.kt @@ -1,5 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR - object Whatever { operator fun getValue(thisRef: Any?, prop: Any?) = "OK" } diff --git a/compiler/testData/codegen/box/delegatedProperty/local/kt21085.kt b/compiler/testData/codegen/box/delegatedProperty/local/kt21085.kt index 2d513dcfe0f..64a00365ff1 100644 --- a/compiler/testData/codegen/box/delegatedProperty/local/kt21085.kt +++ b/compiler/testData/codegen/box/delegatedProperty/local/kt21085.kt @@ -1,5 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR - class Delegate(val value: String) { operator fun getValue(thisRef: Any?, kProperty: Any?) = value } diff --git a/compiler/testData/codegen/box/delegatedProperty/local/localVal.kt b/compiler/testData/codegen/box/delegatedProperty/local/localVal.kt index 6bbbe7b4166..cd3f7178453 100644 --- a/compiler/testData/codegen/box/delegatedProperty/local/localVal.kt +++ b/compiler/testData/codegen/box/delegatedProperty/local/localVal.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR package foo import kotlin.reflect.KProperty diff --git a/compiler/testData/codegen/box/delegatedProperty/local/localValNoExplicitType.kt b/compiler/testData/codegen/box/delegatedProperty/local/localValNoExplicitType.kt index 37eefc8882c..20e86275732 100644 --- a/compiler/testData/codegen/box/delegatedProperty/local/localValNoExplicitType.kt +++ b/compiler/testData/codegen/box/delegatedProperty/local/localValNoExplicitType.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR package foo import kotlin.reflect.KProperty diff --git a/compiler/testData/codegen/box/delegatedProperty/local/localVar.kt b/compiler/testData/codegen/box/delegatedProperty/local/localVar.kt index ff643ab4517..606bc60c871 100644 --- a/compiler/testData/codegen/box/delegatedProperty/local/localVar.kt +++ b/compiler/testData/codegen/box/delegatedProperty/local/localVar.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR package foo import kotlin.reflect.KProperty diff --git a/compiler/testData/codegen/box/delegatedProperty/local/localVarNoExplicitType.kt b/compiler/testData/codegen/box/delegatedProperty/local/localVarNoExplicitType.kt index 98f78f08639..b9e51893775 100644 --- a/compiler/testData/codegen/box/delegatedProperty/local/localVarNoExplicitType.kt +++ b/compiler/testData/codegen/box/delegatedProperty/local/localVarNoExplicitType.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR package foo import kotlin.reflect.KProperty diff --git a/compiler/testData/codegen/box/delegatedProperty/optimizedDelegatedProperties/definedInSources.kt b/compiler/testData/codegen/box/delegatedProperty/optimizedDelegatedProperties/definedInSources.kt index c8acd8029a3..073c1676afb 100644 --- a/compiler/testData/codegen/box/delegatedProperty/optimizedDelegatedProperties/definedInSources.kt +++ b/compiler/testData/codegen/box/delegatedProperty/optimizedDelegatedProperties/definedInSources.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR class Provider(val _value: T) { inline operator fun provideDelegate(thisRef: Any?, kProperty: Any?) = Mut(_value) diff --git a/compiler/testData/codegen/box/delegatedProperty/optimizedDelegatedProperties/definedInSourcesWithNonNullParameter.kt b/compiler/testData/codegen/box/delegatedProperty/optimizedDelegatedProperties/definedInSourcesWithNonNullParameter.kt index 0184c91652f..590afc160bc 100644 --- a/compiler/testData/codegen/box/delegatedProperty/optimizedDelegatedProperties/definedInSourcesWithNonNullParameter.kt +++ b/compiler/testData/codegen/box/delegatedProperty/optimizedDelegatedProperties/definedInSourcesWithNonNullParameter.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR class Provider(val _value: T) { inline operator fun provideDelegate(thisRef: Any?, kProperty: Any) = Mut(_value) diff --git a/compiler/testData/codegen/box/delegatedProperty/optimizedDelegatedProperties/inSeparateModule.kt b/compiler/testData/codegen/box/delegatedProperty/optimizedDelegatedProperties/inSeparateModule.kt index 618ce86dc9b..a0e2d564484 100644 --- a/compiler/testData/codegen/box/delegatedProperty/optimizedDelegatedProperties/inSeparateModule.kt +++ b/compiler/testData/codegen/box/delegatedProperty/optimizedDelegatedProperties/inSeparateModule.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR // MODULE: lib // FILE: lib.kt package lib diff --git a/compiler/testData/codegen/box/delegatedProperty/optimizedDelegatedProperties/inSeparateModuleWithNonNullParameter.kt b/compiler/testData/codegen/box/delegatedProperty/optimizedDelegatedProperties/inSeparateModuleWithNonNullParameter.kt index 98eb2412abd..b6ee79d4b73 100644 --- a/compiler/testData/codegen/box/delegatedProperty/optimizedDelegatedProperties/inSeparateModuleWithNonNullParameter.kt +++ b/compiler/testData/codegen/box/delegatedProperty/optimizedDelegatedProperties/inSeparateModuleWithNonNullParameter.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR // MODULE: lib // FILE: lib.kt package lib diff --git a/compiler/testData/codegen/box/delegatedProperty/optimizedDelegatedProperties/kt40815.kt b/compiler/testData/codegen/box/delegatedProperty/optimizedDelegatedProperties/kt40815.kt index 9d6fce69386..270c8d4a208 100644 --- a/compiler/testData/codegen/box/delegatedProperty/optimizedDelegatedProperties/kt40815.kt +++ b/compiler/testData/codegen/box/delegatedProperty/optimizedDelegatedProperties/kt40815.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR import kotlin.reflect.KProperty operator fun Int.provideDelegate(thiz: Any?, property: KProperty<*>): String = property.name diff --git a/compiler/testData/codegen/box/delegatedProperty/optimizedDelegatedProperties/lazy.kt b/compiler/testData/codegen/box/delegatedProperty/optimizedDelegatedProperties/lazy.kt index 1a6e8bfd91c..d4e1d498861 100644 --- a/compiler/testData/codegen/box/delegatedProperty/optimizedDelegatedProperties/lazy.kt +++ b/compiler/testData/codegen/box/delegatedProperty/optimizedDelegatedProperties/lazy.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR // WITH_RUNTIME val topLevelLazyVal by lazy { 1 } diff --git a/compiler/testData/codegen/box/delegatedProperty/provideDelegate/genericDelegateWithNoAdditionalInfo.kt b/compiler/testData/codegen/box/delegatedProperty/provideDelegate/genericDelegateWithNoAdditionalInfo.kt index 71cd307314e..cb593164c27 100644 --- a/compiler/testData/codegen/box/delegatedProperty/provideDelegate/genericDelegateWithNoAdditionalInfo.kt +++ b/compiler/testData/codegen/box/delegatedProperty/provideDelegate/genericDelegateWithNoAdditionalInfo.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR // WITH_RUNTIME import kotlin.reflect.KProperty diff --git a/compiler/testData/codegen/box/delegatedProperty/provideDelegate/local.kt b/compiler/testData/codegen/box/delegatedProperty/provideDelegate/local.kt index feeb5b5a24b..e010f9f1242 100644 --- a/compiler/testData/codegen/box/delegatedProperty/provideDelegate/local.kt +++ b/compiler/testData/codegen/box/delegatedProperty/provideDelegate/local.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR // WITH_RUNTIME import kotlin.test.* diff --git a/compiler/testData/codegen/box/delegatedProperty/provideDelegate/localCaptured.kt b/compiler/testData/codegen/box/delegatedProperty/provideDelegate/localCaptured.kt index 20be53cae76..1018b841950 100644 --- a/compiler/testData/codegen/box/delegatedProperty/provideDelegate/localCaptured.kt +++ b/compiler/testData/codegen/box/delegatedProperty/provideDelegate/localCaptured.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR // WITH_RUNTIME import kotlin.test.* diff --git a/compiler/testData/codegen/box/delegatedProperty/provideDelegate/localDifferentReceivers.kt b/compiler/testData/codegen/box/delegatedProperty/provideDelegate/localDifferentReceivers.kt index d4b16f1ca4b..387236a5640 100644 --- a/compiler/testData/codegen/box/delegatedProperty/provideDelegate/localDifferentReceivers.kt +++ b/compiler/testData/codegen/box/delegatedProperty/provideDelegate/localDifferentReceivers.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR // WITH_RUNTIME import kotlin.test.* diff --git a/compiler/testData/codegen/box/inlineClasses/kt25750.kt b/compiler/testData/codegen/box/inlineClasses/kt25750.kt index 6053387619c..bdb0cd98ffe 100644 --- a/compiler/testData/codegen/box/inlineClasses/kt25750.kt +++ b/compiler/testData/codegen/box/inlineClasses/kt25750.kt @@ -1,5 +1,4 @@ // !LANGUAGE: +InlineClasses -// IGNORE_BACKEND_FIR: JVM_IR // WITH_RUNTIME import kotlin.reflect.KMutableProperty0 diff --git a/compiler/testData/codegen/box/inlineClasses/propertyDelegation/captureLocalVarDelegatedToInlineClass.kt b/compiler/testData/codegen/box/inlineClasses/propertyDelegation/captureLocalVarDelegatedToInlineClass.kt index 745b26e01e7..b677ce3ab9b 100644 --- a/compiler/testData/codegen/box/inlineClasses/propertyDelegation/captureLocalVarDelegatedToInlineClass.kt +++ b/compiler/testData/codegen/box/inlineClasses/propertyDelegation/captureLocalVarDelegatedToInlineClass.kt @@ -1,5 +1,4 @@ // !LANGUAGE: +InlineClasses -// IGNORE_BACKEND_FIR: JVM_IR var setterInvoked = 0 diff --git a/compiler/testData/codegen/box/inlineClasses/propertyDelegation/delegateLocalVarToInlineClass.kt b/compiler/testData/codegen/box/inlineClasses/propertyDelegation/delegateLocalVarToInlineClass.kt index fc103aede68..c676535dbfa 100644 --- a/compiler/testData/codegen/box/inlineClasses/propertyDelegation/delegateLocalVarToInlineClass.kt +++ b/compiler/testData/codegen/box/inlineClasses/propertyDelegation/delegateLocalVarToInlineClass.kt @@ -1,5 +1,4 @@ // !LANGUAGE: +InlineClasses -// IGNORE_BACKEND_FIR: JVM_IR var setterInvoked = 0 diff --git a/compiler/testData/codegen/box/inlineClasses/propertyDelegation/delegatedPropertyOfInlineClassType.kt b/compiler/testData/codegen/box/inlineClasses/propertyDelegation/delegatedPropertyOfInlineClassType.kt index 0c34de06e5b..f3f308eca92 100644 --- a/compiler/testData/codegen/box/inlineClasses/propertyDelegation/delegatedPropertyOfInlineClassType.kt +++ b/compiler/testData/codegen/box/inlineClasses/propertyDelegation/delegatedPropertyOfInlineClassType.kt @@ -1,5 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR - import kotlin.reflect.KProperty inline class ICInt(val i: Int) diff --git a/compiler/testData/ir/irText/declarations/annotations/localDelegatedPropertiesWithAnnotations.fir.txt b/compiler/testData/ir/irText/declarations/annotations/localDelegatedPropertiesWithAnnotations.fir.txt index ecc3c8e8d70..ef62f77ab83 100644 --- a/compiler/testData/ir/irText/declarations/annotations/localDelegatedPropertiesWithAnnotations.fir.txt +++ b/compiler/testData/ir/irText/declarations/annotations/localDelegatedPropertiesWithAnnotations.fir.txt @@ -30,4 +30,20 @@ FILE fqName: fileName:/localDelegatedPropertiesWithAnnotations.kt FUN name:foo visibility:public modality:FINAL <> (m:kotlin.collections.Map) returnType:kotlin.Unit VALUE_PARAMETER name:m index:0 type:kotlin.collections.Map BLOCK_BODY - VAR name:test type:kotlin.Int [val] + LOCAL_DELEGATED_PROPERTY name:test type:kotlin.Int flags:val + VAR PROPERTY_DELEGATE name:test$delegate type:kotlin.Lazy [val] + CALL 'public final fun lazy (initializer: kotlin.Function0): kotlin.Lazy declared in kotlin' type=kotlin.Lazy origin=null + : kotlin.Int + initializer: FUN_EXPR type=kotlin.Function0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): kotlin.Int declared in .foo' + CONST Int type=kotlin.Int value=42 + FUN DELEGATED_PROPERTY_ACCESSOR name: visibility:local modality:FINAL <> () returnType:kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): kotlin.Int declared in .foo' + CALL 'public final fun getValue (thisRef: kotlin.Any?, property: kotlin.reflect.KProperty<*>): T of kotlin.getValue [inline,operator] declared in kotlin' type=kotlin.Int origin=null + : kotlin.Int + $receiver: GET_VAR 'val test$delegate: kotlin.Lazy [val] declared in .foo' type=kotlin.Lazy origin=null + thisRef: CONST Null type=kotlin.Nothing? value=null + property: LOCAL_DELEGATED_PROPERTY_REFERENCE 'val test: kotlin.Int by (...)' delegate='val test$delegate: kotlin.Lazy [val] declared in .foo' getter='local final fun (): kotlin.Int declared in .foo' setter=null type=kotlin.reflect.KProperty0 origin=PROPERTY_REFERENCE_FOR_DELEGATE diff --git a/compiler/testData/ir/irText/declarations/localDelegatedProperties.fir.txt b/compiler/testData/ir/irText/declarations/localDelegatedProperties.fir.txt index e5aea5de02d..95adaf325bb 100644 --- a/compiler/testData/ir/irText/declarations/localDelegatedProperties.fir.txt +++ b/compiler/testData/ir/irText/declarations/localDelegatedProperties.fir.txt @@ -1,24 +1,62 @@ FILE fqName: fileName:/localDelegatedProperties.kt FUN name:test1 visibility:public modality:FINAL <> () returnType:kotlin.Unit BLOCK_BODY - VAR name:x type:kotlin.Int [val] + LOCAL_DELEGATED_PROPERTY name:x type:kotlin.Int flags:val + VAR PROPERTY_DELEGATE name:x$delegate type:kotlin.Lazy [val] + CALL 'public final fun lazy (initializer: kotlin.Function0): kotlin.Lazy declared in kotlin' type=kotlin.Lazy origin=null + : kotlin.Int + initializer: FUN_EXPR type=kotlin.Function0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): kotlin.Int declared in .test1' + CONST Int type=kotlin.Int value=42 + FUN DELEGATED_PROPERTY_ACCESSOR name: visibility:local modality:FINAL <> () returnType:kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): kotlin.Int declared in .test1' + CALL 'public final fun getValue (thisRef: kotlin.Any?, property: kotlin.reflect.KProperty<*>): T of kotlin.getValue [inline,operator] declared in kotlin' type=kotlin.Int origin=null + : kotlin.Int + $receiver: GET_VAR 'val x$delegate: kotlin.Lazy [val] declared in .test1' type=kotlin.Lazy origin=null + thisRef: CONST Null type=kotlin.Nothing? value=null + property: LOCAL_DELEGATED_PROPERTY_REFERENCE 'val x: kotlin.Int by (...)' delegate='val x$delegate: kotlin.Lazy [val] declared in .test1' getter='local final fun (): kotlin.Int declared in .test1' setter=null type=kotlin.reflect.KProperty0 origin=PROPERTY_REFERENCE_FOR_DELEGATE CALL 'public final fun println (message: kotlin.Int): kotlin.Unit [inline] declared in kotlin.io' type=kotlin.Unit origin=null - message: GET_VAR 'val x: kotlin.Int [val] declared in .test1' type=kotlin.Int origin=null + message: CALL 'local final fun (): kotlin.Int declared in .test1' type=kotlin.Int origin=GET_LOCAL_PROPERTY FUN name:test2 visibility:public modality:FINAL <> () returnType:kotlin.Unit BLOCK_BODY - VAR name:x type:kotlin.Int? [var] - SET_VAR 'var x: kotlin.Int? [var] declared in .test2' type=kotlin.Unit origin=EQ - CONST Int type=kotlin.Int value=0 + LOCAL_DELEGATED_PROPERTY name:x type:kotlin.Int? flags:var + VAR PROPERTY_DELEGATE name:x$delegate type:java.util.HashMap [val] + CALL 'public final fun hashMapOf (): java.util.HashMap [inline] declared in kotlin.collections' type=java.util.HashMap origin=null + : kotlin.String + : kotlin.Int + FUN DELEGATED_PROPERTY_ACCESSOR name: visibility:local modality:FINAL <> () returnType:kotlin.Int? + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): kotlin.Int? declared in .test2' + CALL 'public final fun getValue (thisRef: kotlin.Any?, property: kotlin.reflect.KProperty<*>): V1 of kotlin.collections.getValue [inline,operator] declared in kotlin.collections' type=kotlin.Int? origin=null + : kotlin.Int? + : kotlin.Int? + $receiver: GET_VAR 'val x$delegate: java.util.HashMap [val] declared in .test2' type=java.util.HashMap origin=null + thisRef: CONST Null type=kotlin.Nothing? value=null + property: LOCAL_DELEGATED_PROPERTY_REFERENCE 'var x: kotlin.Int? by (...)' delegate='val x$delegate: java.util.HashMap [val] declared in .test2' getter='local final fun (): kotlin.Int? declared in .test2' setter='local final fun (: kotlin.Int?): kotlin.Unit declared in .test2' type=kotlin.reflect.KMutableProperty0 origin=PROPERTY_REFERENCE_FOR_DELEGATE + FUN DELEGATED_PROPERTY_ACCESSOR name: visibility:local modality:FINAL <> (:kotlin.Int?) returnType:kotlin.Unit + 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 kotlin.collections.setValue): kotlin.Unit [inline,operator] declared in kotlin.collections' type=kotlin.Unit origin=null + : kotlin.Int? + $receiver: GET_VAR 'val x$delegate: java.util.HashMap [val] declared in .test2' type=java.util.HashMap origin=null + thisRef: CONST Null type=kotlin.Nothing? value=null + property: LOCAL_DELEGATED_PROPERTY_REFERENCE 'var x: kotlin.Int? by (...)' delegate='val x$delegate: java.util.HashMap [val] declared in .test2' getter='local final fun (): kotlin.Int? declared in .test2' setter='local final fun (: kotlin.Int?): kotlin.Unit declared in .test2' type=kotlin.reflect.KMutableProperty0 origin=PROPERTY_REFERENCE_FOR_DELEGATE + value: GET_VAR ': kotlin.Int? declared in .test2.' type=kotlin.Int? origin=null + CALL 'local final fun (: kotlin.Int?): kotlin.Unit declared in .test2' type=kotlin.Unit origin=EQ + : CONST Int type=kotlin.Int value=0 VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:kotlin.Int [val] TYPE_OP type=kotlin.Int origin=IMPLICIT_CAST typeOperand=kotlin.Int - GET_VAR 'var x: kotlin.Int? [var] declared in .test2' type=kotlin.Int? origin=null - SET_VAR 'var x: kotlin.Int? [var] declared in .test2' type=kotlin.Unit origin=EQ - CALL 'public final fun inc (): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null + CALL 'local final fun (): kotlin.Int? declared in .test2' type=kotlin.Int? origin=GET_LOCAL_PROPERTY + CALL 'local final fun (: kotlin.Int?): kotlin.Unit declared in .test2' type=kotlin.Unit origin=EQ + : CALL 'public final fun inc (): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null $this: GET_VAR 'val tmp_0: kotlin.Int [val] declared in .test2' type=kotlin.Int origin=null TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit GET_VAR 'val tmp_0: kotlin.Int [val] declared in .test2' type=kotlin.Int origin=null - SET_VAR 'var x: kotlin.Int? [var] declared in .test2' type=kotlin.Unit origin=EQ - CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null + CALL 'local final fun (: kotlin.Int?): kotlin.Unit declared in .test2' type=kotlin.Unit origin=EQ + : CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null $this: TYPE_OP type=kotlin.Int origin=IMPLICIT_CAST typeOperand=kotlin.Int - GET_VAR 'var x: kotlin.Int? [var] declared in .test2' type=kotlin.Int? origin=null + CALL 'local final fun (): kotlin.Int? declared in .test2' type=kotlin.Int? origin=GET_LOCAL_PROPERTY other: CONST Int type=kotlin.Int value=1 diff --git a/compiler/testData/ir/irText/declarations/provideDelegate/local.fir.txt b/compiler/testData/ir/irText/declarations/provideDelegate/local.fir.txt deleted file mode 100644 index 31ed33956e4..00000000000 --- a/compiler/testData/ir/irText/declarations/provideDelegate/local.fir.txt +++ /dev/null @@ -1,83 +0,0 @@ -FILE fqName: fileName:/local.kt - CLASS CLASS name:Delegate modality:FINAL visibility:public superTypes:[kotlin.Any] - $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Delegate - CONSTRUCTOR visibility:public <> (value:kotlin.String) returnType:.Delegate [primary] - VALUE_PARAMETER name:value index:0 type:kotlin.String - BLOCK_BODY - DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' - INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Delegate modality:FINAL visibility:public superTypes:[kotlin.Any]' - PROPERTY name:value visibility:public modality:FINAL [val] - FIELD PROPERTY_BACKING_FIELD name:value type:kotlin.String visibility:private [final] - EXPRESSION_BODY - GET_VAR 'value: kotlin.String declared in .Delegate.' type=kotlin.String origin=INITIALIZE_PROPERTY_FROM_PARAMETER - FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.Delegate) returnType:kotlin.String - correspondingProperty: PROPERTY name:value visibility:public modality:FINAL [val] - $this: VALUE_PARAMETER name: type:.Delegate - BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun (): kotlin.String declared in .Delegate' - GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:value type:kotlin.String visibility:private [final]' type=kotlin.String origin=null - receiver: GET_VAR ': .Delegate declared in .Delegate.' type=.Delegate origin=null - FUN name:getValue visibility:public modality:FINAL <> ($this:.Delegate, thisRef:kotlin.Any?, property:kotlin.Any?) returnType:kotlin.String [operator] - $this: VALUE_PARAMETER name: type:.Delegate - VALUE_PARAMETER name:thisRef index:0 type:kotlin.Any? - VALUE_PARAMETER name:property index:1 type:kotlin.Any? - BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun getValue (thisRef: kotlin.Any?, property: kotlin.Any?): kotlin.String [operator] declared in .Delegate' - CALL 'public final fun (): kotlin.String declared in .Delegate' type=kotlin.String origin=GET_PROPERTY - $this: GET_VAR ': .Delegate declared in .Delegate.getValue' type=.Delegate 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:DelegateProvider modality:FINAL visibility:public superTypes:[kotlin.Any] - $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.DelegateProvider - CONSTRUCTOR visibility:public <> (value:kotlin.String) returnType:.DelegateProvider [primary] - VALUE_PARAMETER name:value index:0 type:kotlin.String - BLOCK_BODY - DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' - INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:DelegateProvider modality:FINAL visibility:public superTypes:[kotlin.Any]' - PROPERTY name:value visibility:public modality:FINAL [val] - FIELD PROPERTY_BACKING_FIELD name:value type:kotlin.String visibility:private [final] - EXPRESSION_BODY - GET_VAR 'value: kotlin.String declared in .DelegateProvider.' type=kotlin.String origin=INITIALIZE_PROPERTY_FROM_PARAMETER - FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.DelegateProvider) returnType:kotlin.String - correspondingProperty: PROPERTY name:value visibility:public modality:FINAL [val] - $this: VALUE_PARAMETER name: type:.DelegateProvider - BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun (): kotlin.String declared in .DelegateProvider' - GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:value type:kotlin.String visibility:private [final]' type=kotlin.String origin=null - receiver: GET_VAR ': .DelegateProvider declared in .DelegateProvider.' type=.DelegateProvider origin=null - FUN name:provideDelegate visibility:public modality:FINAL <> ($this:.DelegateProvider, thisRef:kotlin.Any?, property:kotlin.Any?) returnType:.Delegate [operator] - $this: VALUE_PARAMETER name: type:.DelegateProvider - VALUE_PARAMETER name:thisRef index:0 type:kotlin.Any? - VALUE_PARAMETER name:property index:1 type:kotlin.Any? - BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun provideDelegate (thisRef: kotlin.Any?, property: kotlin.Any?): .Delegate [operator] declared in .DelegateProvider' - CONSTRUCTOR_CALL 'public constructor (value: kotlin.String) [primary] declared in .Delegate' type=.Delegate origin=null - value: CALL 'public final fun (): kotlin.String declared in .DelegateProvider' type=kotlin.String origin=GET_PROPERTY - $this: GET_VAR ': .DelegateProvider declared in .DelegateProvider.provideDelegate' type=.DelegateProvider 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 - FUN name:foo visibility:public modality:FINAL <> () returnType:kotlin.Unit - BLOCK_BODY - VAR name:testMember type:kotlin.String [val] diff --git a/compiler/testData/ir/irText/declarations/provideDelegate/local.kt b/compiler/testData/ir/irText/declarations/provideDelegate/local.kt index e0a5ec7abc8..0809981ff6c 100644 --- a/compiler/testData/ir/irText/declarations/provideDelegate/local.kt +++ b/compiler/testData/ir/irText/declarations/provideDelegate/local.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL class Delegate(val value: String) { operator fun getValue(thisRef: Any?, property: Any?) = value } diff --git a/compiler/testData/ir/irText/declarations/provideDelegate/localDifferentReceivers.fir.txt b/compiler/testData/ir/irText/declarations/provideDelegate/localDifferentReceivers.fir.txt deleted file mode 100644 index 199bbee2287..00000000000 --- a/compiler/testData/ir/irText/declarations/provideDelegate/localDifferentReceivers.fir.txt +++ /dev/null @@ -1,57 +0,0 @@ -FILE fqName: fileName:/localDifferentReceivers.kt - CLASS CLASS name:MyClass modality:FINAL visibility:public superTypes:[kotlin.Any] - $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.MyClass - CONSTRUCTOR visibility:public <> (value:kotlin.String) returnType:.MyClass [primary] - VALUE_PARAMETER name:value index:0 type:kotlin.String - BLOCK_BODY - DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' - INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:MyClass modality:FINAL visibility:public superTypes:[kotlin.Any]' - PROPERTY name:value visibility:public modality:FINAL [val] - FIELD PROPERTY_BACKING_FIELD name:value type:kotlin.String visibility:private [final] - EXPRESSION_BODY - GET_VAR 'value: kotlin.String declared in .MyClass.' type=kotlin.String origin=INITIALIZE_PROPERTY_FROM_PARAMETER - FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.MyClass) returnType:kotlin.String - correspondingProperty: PROPERTY name:value visibility:public modality:FINAL [val] - $this: VALUE_PARAMETER name: type:.MyClass - BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun (): kotlin.String declared in .MyClass' - GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:value type:kotlin.String visibility:private [final]' type=kotlin.String origin=null - receiver: GET_VAR ': .MyClass declared in .MyClass.' type=.MyClass 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 - FUN name:provideDelegate visibility:public modality:FINAL <> ($receiver:.MyClass, host:kotlin.Any?, p:kotlin.Any) returnType:kotlin.String [operator] - $receiver: VALUE_PARAMETER name: type:.MyClass - VALUE_PARAMETER name:host index:0 type:kotlin.Any? - VALUE_PARAMETER name:p index:1 type:kotlin.Any - BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun provideDelegate (host: kotlin.Any?, p: kotlin.Any): kotlin.String [operator] declared in ' - CALL 'public final fun (): kotlin.String declared in .MyClass' type=kotlin.String origin=GET_PROPERTY - $this: GET_VAR ': .MyClass declared in .provideDelegate' type=.MyClass origin=null - FUN name:getValue visibility:public modality:FINAL <> ($receiver:kotlin.String, receiver:kotlin.Any?, p:kotlin.Any) returnType:kotlin.String [operator] - $receiver: VALUE_PARAMETER name: type:kotlin.String - VALUE_PARAMETER name:receiver index:0 type:kotlin.Any? - VALUE_PARAMETER name:p index:1 type:kotlin.Any - BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun getValue (receiver: kotlin.Any?, p: kotlin.Any): kotlin.String [operator] declared in ' - GET_VAR ': kotlin.String declared in .getValue' type=kotlin.String origin=null - FUN name:box visibility:public modality:FINAL <> () returnType:kotlin.String - BLOCK_BODY - VAR name:testO type:kotlin.String [val] - VAR name:testK type:kotlin.String [val] - VAR name:testOK type:kotlin.String [val] - CALL 'public final fun plus (other: kotlin.Any?): kotlin.String [operator] declared in kotlin.String' type=kotlin.String origin=PLUS - $this: GET_VAR 'val testO: kotlin.String [val] declared in .box' type=kotlin.String origin=null - other: GET_VAR 'val testK: kotlin.String [val] declared in .box' type=kotlin.String origin=null - RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in ' - GET_VAR 'val testOK: kotlin.String [val] declared in .box' type=kotlin.String origin=null diff --git a/compiler/testData/ir/irText/declarations/provideDelegate/localDifferentReceivers.kt b/compiler/testData/ir/irText/declarations/provideDelegate/localDifferentReceivers.kt index aac495b6526..6e9b97ad2dd 100644 --- a/compiler/testData/ir/irText/declarations/provideDelegate/localDifferentReceivers.kt +++ b/compiler/testData/ir/irText/declarations/provideDelegate/localDifferentReceivers.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // WITH_RUNTIME class MyClass(val value: String)