From 7cfec0d84619c23f8a8bf68889bee48edfd9f307 Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Fri, 3 Dec 2021 15:34:06 +0300 Subject: [PATCH] FIR2IR: find & use delegate-to members properly --- .../generators/DelegatedMemberGenerator.kt | 175 ++++++++++++------ .../delegatedImplementation.fir.ir.txt | 12 +- ...lementationWithExplicitOverride.fir.ir.txt | 2 +- ...otNullOnDelegatedImplementation.fir.ir.txt | 10 +- .../ir/irText/classes/kt45934.fir.ir.txt | 3 +- .../nullCheckOnInterfaceDelegation.fir.ir.txt | 2 +- 6 files changed, 128 insertions(+), 76 deletions(-) diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/DelegatedMemberGenerator.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/DelegatedMemberGenerator.kt index 629e711d04f..3a0db2f0f72 100644 --- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/DelegatedMemberGenerator.kt +++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/DelegatedMemberGenerator.kt @@ -10,14 +10,17 @@ import org.jetbrains.kotlin.fir.* import org.jetbrains.kotlin.fir.backend.* import org.jetbrains.kotlin.fir.declarations.* import org.jetbrains.kotlin.fir.declarations.utils.modality +import org.jetbrains.kotlin.fir.resolve.fullyExpandedType +import org.jetbrains.kotlin.fir.scopes.* import org.jetbrains.kotlin.fir.scopes.impl.delegatedWrapperData -import org.jetbrains.kotlin.fir.scopes.processAllFunctions -import org.jetbrains.kotlin.fir.scopes.processAllProperties -import org.jetbrains.kotlin.fir.scopes.unsubstitutedScope import org.jetbrains.kotlin.fir.symbols.ConeClassLikeLookupTag import org.jetbrains.kotlin.fir.symbols.impl.FirCallableSymbol import org.jetbrains.kotlin.fir.symbols.impl.FirNamedFunctionSymbol import org.jetbrains.kotlin.fir.symbols.impl.FirPropertySymbol +import org.jetbrains.kotlin.fir.types.ConeClassLikeType +import org.jetbrains.kotlin.fir.types.coneType +import org.jetbrains.kotlin.fir.types.lowerBoundIfFlexible +import org.jetbrains.kotlin.fir.types.toSymbol import org.jetbrains.kotlin.ir.declarations.* import org.jetbrains.kotlin.ir.expressions.IrBlockBody import org.jetbrains.kotlin.ir.expressions.impl.IrCallImpl @@ -31,6 +34,7 @@ import org.jetbrains.kotlin.ir.types.isUnit import org.jetbrains.kotlin.name.ClassId import org.jetbrains.kotlin.name.FqName import org.jetbrains.kotlin.name.JvmNames.JVM_DEFAULT_CLASS_ID +import org.jetbrains.kotlin.name.Name /** * A generator for delegated members from implementation by delegation. @@ -43,34 +47,31 @@ class DelegatedMemberGenerator( private val components: Fir2IrComponents ) : Fir2IrComponents by components { - companion object { - private val PLATFORM_DEPENDENT_CLASS_ID = ClassId.topLevel(FqName("kotlin.internal.PlatformDependent")) - } - private val baseFunctionSymbols = mutableMapOf>() private val basePropertySymbols = mutableMapOf>() private data class DeclarationBodyInfo( val declaration: IrDeclaration, val field: IrField, - val delegateToSymbol: FirCallableSymbol<*> + val delegateToSymbol: FirCallableSymbol<*>, + val delegateToLookupTag: ConeClassLikeLookupTag? ) private val bodiesInfo = mutableListOf() fun generateBodies() { - for ((declaration, irField, delegateToSymbol) in bodiesInfo) { + for ((declaration, irField, delegateToSymbol, delegateToLookupTag) in bodiesInfo) { when (declaration) { is IrSimpleFunction -> { val member = declarationStorage.getIrFunctionSymbol( - delegateToSymbol as FirNamedFunctionSymbol + delegateToSymbol as FirNamedFunctionSymbol, delegateToLookupTag ).owner as? IrSimpleFunction ?: continue val body = createDelegateBody(irField, declaration, member) declaration.body = body } is IrProperty -> { val member = declarationStorage.getIrPropertySymbol( - delegateToSymbol as FirPropertySymbol + delegateToSymbol as FirPropertySymbol, delegateToLookupTag ).owner as? IrProperty ?: continue val getter = declaration.getter!! getter.body = createDelegateBody(irField, getter, member.getter!!) @@ -84,25 +85,43 @@ class DelegatedMemberGenerator( bodiesInfo.clear() } + private fun FirTypeParameter.boundClass(): FirClass { + val boundType = bounds.first().coneType.fullyExpandedType(session).lowerBoundIfFlexible() + val boundClassifier = boundType.toSymbol(session)!!.fir + if (boundClassifier is FirClass) return boundClassifier + return (boundClassifier as FirTypeParameter).boundClass() + } + // Generate delegated members for [subClass]. The synthetic field [irField] has the super interface type. fun generate(irField: IrField, firField: FirField, firSubClass: FirClass, subClass: IrClass) { val subClassLookupTag = firSubClass.symbol.toLookupTag() - val subClassScope = firSubClass.unsubstitutedScope(session, scopeSession, withForcedTypeCalculator = true) + val subClassScope = firSubClass.unsubstitutedScope(session, scopeSession, withForcedTypeCalculator = false) + val delegateToType = firField.initializer!!.typeRef.coneType.fullyExpandedType(session).lowerBoundIfFlexible() + val delegateToClass = when (val fir = delegateToType.toSymbol(session)?.fir) { + is FirClass -> fir + is FirTypeParameter -> fir.boundClass() + else -> throw AssertionError("${fir?.render()}") + } + + val delegateToScope = delegateToClass.unsubstitutedScope(session, scopeSession, withForcedTypeCalculator = false) + val delegateToLookupTag = (delegateToType as? ConeClassLikeType)?.lookupTag + subClassScope.processAllFunctions { functionSymbol -> val unwrapped = - functionSymbol - .unwrapDelegateTarget(subClassLookupTag, firField) + functionSymbol.unwrapDelegateTarget(subClassLookupTag, firField) ?: return@processAllFunctions - if (shouldSkipDelegationFor(unwrapped)) { - return@processAllFunctions - } + val delegateToSymbol = findDelegateToSymbol( + unwrapped.symbol, + delegateToScope::processFunctionsByName, + delegateToScope::processOverriddenFunctions + ) ?: return@processAllFunctions val irSubFunction = generateDelegatedFunction( subClass, firSubClass, functionSymbol.fir ) - bodiesInfo += DeclarationBodyInfo(irSubFunction, irField, unwrapped.symbol) + bodiesInfo += DeclarationBodyInfo(irSubFunction, irField, delegateToSymbol, delegateToLookupTag) declarationStorage.cacheDelegationFunction(functionSymbol.fir, irSubFunction) subClass.addMember(irSubFunction) } @@ -111,42 +130,54 @@ class DelegatedMemberGenerator( if (propertySymbol !is FirPropertySymbol) return@processAllProperties val unwrapped = - propertySymbol - .unwrapDelegateTarget(subClassLookupTag, firField) + propertySymbol.unwrapDelegateTarget(subClassLookupTag, firField) ?: return@processAllProperties - if (shouldSkipDelegationFor(unwrapped)) { - return@processAllProperties - } + val delegateToSymbol = findDelegateToSymbol( + unwrapped.symbol, + { name, processor -> + delegateToScope.processPropertiesByName(name) { + if (it !is FirPropertySymbol) return@processPropertiesByName + processor(it) + } + }, + delegateToScope::processOverriddenProperties + ) ?: return@processAllProperties val irSubProperty = generateDelegatedProperty( subClass, firSubClass, propertySymbol.fir ) - bodiesInfo += DeclarationBodyInfo(irSubProperty, irField, unwrapped.symbol) + bodiesInfo += DeclarationBodyInfo(irSubProperty, irField, delegateToSymbol, delegateToLookupTag) declarationStorage.cacheDelegatedProperty(propertySymbol.fir, irSubProperty) subClass.addMember(irSubProperty) } } - private fun shouldSkipDelegationFor(unwrapped: FirCallableDeclaration): Boolean { - // See org.jetbrains.kotlin.resolve.jvm.JvmDelegationFilter - return (unwrapped is FirSimpleFunction && unwrapped.isDefaultJavaMethod()) || - unwrapped.hasAnnotation(JVM_DEFAULT_CLASS_ID) || - unwrapped.hasAnnotation(PLATFORM_DEPENDENT_CLASS_ID) - } - - private fun FirSimpleFunction.isDefaultJavaMethod(): Boolean = - when { - isIntersectionOverride -> - baseForIntersectionOverride!!.isDefaultJavaMethod() - isSubstitutionOverride -> - originalForSubstitutionOverride!!.isDefaultJavaMethod() - else -> { - // Check that we have a non-abstract method from Java interface - origin == FirDeclarationOrigin.Enhancement && modality == Modality.OPEN + private inline fun > findDelegateToSymbol( + unwrappedSymbol: S, + processCallables: (name: Name, processor: (S) -> Unit) -> Unit, + crossinline processOverridden: (base: S, processor: (S) -> ProcessorAction) -> ProcessorAction + ): S? { + var result: S? = null + // The purpose of this code is to find member in delegate-to scope + // which matches or overrides unwrappedSymbol (which is in turn taken from subclass scope). + processCallables(unwrappedSymbol.name) { candidateSymbol -> + if (result != null) return@processCallables + if (candidateSymbol === unwrappedSymbol) { + result = candidateSymbol + return@processCallables + } + processOverridden(candidateSymbol) { + if (it === unwrappedSymbol) { + result = candidateSymbol + ProcessorAction.STOP + } else { + ProcessorAction.NEXT + } } } - + return result + } fun bindDelegatedMembersOverriddenSymbols(irClass: IrClass) { val superClasses by lazy(LazyThreadSafetyMode.NONE) { @@ -275,36 +306,58 @@ class DelegatedMemberGenerator( declarationStorage, fakeOverrideGenerator ) - annotationGenerator.generate(delegateProperty.getter!!, firDelegateProperty) + annotationGenerator.generate(getter, firDelegateProperty) if (delegateProperty.isVar) { val setter = delegateProperty.setter!! setter.overriddenSymbols = firDelegateProperty.generateOverriddenAccessorSymbols( firSubClass, isGetter = false, session, scopeSession, declarationStorage, fakeOverrideGenerator ) - annotationGenerator.generate(delegateProperty.setter!!, firDelegateProperty) + annotationGenerator.generate(setter, firDelegateProperty) } return delegateProperty } + companion object { + private val PLATFORM_DEPENDENT_CLASS_ID = ClassId.topLevel(FqName("kotlin.internal.PlatformDependent")) + private fun , D : FirCallableDeclaration> S.unwrapDelegateTarget( + subClassLookupTag: ConeClassLikeLookupTag, + firField: FirField, + ): D? { + val callable = this.fir as? D ?: return null + + val delegatedWrapperData = callable.delegatedWrapperData ?: return null + if (delegatedWrapperData.containingClass != subClassLookupTag) return null + if (delegatedWrapperData.delegateField != firField) return null + + val wrapped = delegatedWrapperData.wrapped as? D ?: return null + + @Suppress("UNCHECKED_CAST") + val wrappedSymbol = wrapped.symbol as? S ?: return null + + @Suppress("UNCHECKED_CAST") + return (wrappedSymbol.unwrapCallRepresentative().fir as D).takeIf { !shouldSkipDelegationFor(it) } + } + + private fun shouldSkipDelegationFor(unwrapped: FirCallableDeclaration): Boolean { + // See org.jetbrains.kotlin.resolve.jvm.JvmDelegationFilter + return (unwrapped is FirSimpleFunction && unwrapped.isDefaultJavaMethod()) || + unwrapped.hasAnnotation(JVM_DEFAULT_CLASS_ID) || + unwrapped.hasAnnotation(PLATFORM_DEPENDENT_CLASS_ID) + } + + private fun FirSimpleFunction.isDefaultJavaMethod(): Boolean = + when { + isIntersectionOverride -> + baseForIntersectionOverride!!.isDefaultJavaMethod() + isSubstitutionOverride -> + originalForSubstitutionOverride!!.isDefaultJavaMethod() + else -> { + // Check that we have a non-abstract method from Java interface + origin == FirDeclarationOrigin.Enhancement && modality == Modality.OPEN + } + } + } } -private fun , D : FirCallableDeclaration> S.unwrapDelegateTarget( - subClassLookupTag: ConeClassLikeLookupTag, - firField: FirField, -): D? { - val callable = this.fir as? D ?: return null - - val delegatedWrapperData = callable.delegatedWrapperData ?: return null - if (delegatedWrapperData.containingClass != subClassLookupTag) return null - if (delegatedWrapperData.delegateField != firField) return null - - val wrapped = delegatedWrapperData.wrapped as? D ?: return null - - @Suppress("UNCHECKED_CAST") - val wrappedSymbol = wrapped.symbol as? S ?: return null - - @Suppress("UNCHECKED_CAST") - return wrappedSymbol.unwrapCallRepresentative().fir as D -} diff --git a/compiler/testData/ir/irText/classes/delegatedImplementation.fir.ir.txt b/compiler/testData/ir/irText/classes/delegatedImplementation.fir.ir.txt index 90ac57a465f..95677b0958d 100644 --- a/compiler/testData/ir/irText/classes/delegatedImplementation.fir.ir.txt +++ b/compiler/testData/ir/irText/classes/delegatedImplementation.fir.ir.txt @@ -215,7 +215,7 @@ FILE fqName: fileName:/delegatedImplementation.kt VALUE_PARAMETER name:x index:0 type:kotlin.Int VALUE_PARAMETER name:s index:1 type:kotlin.String BLOCK_BODY - CALL 'public abstract fun foo (x: kotlin.Int, s: kotlin.String): kotlin.Unit declared in .IBase' type=kotlin.Unit origin=null + CALL 'public final fun foo (x: kotlin.Int, s: kotlin.String): kotlin.Unit declared in .BaseImpl' type=kotlin.Unit origin=null $this: GET_FIELD 'FIELD DELEGATE name:<$$delegate_0> type:.BaseImpl visibility:local [final]' type=.BaseImpl origin=null receiver: GET_VAR ': .Test1 declared in .Test1.foo' type=.Test1 origin=null x: GET_VAR 'x: kotlin.Int declared in .Test1.foo' type=kotlin.Int origin=null @@ -226,7 +226,7 @@ FILE fqName: fileName:/delegatedImplementation.kt $this: VALUE_PARAMETER name: type:.Test1 BLOCK_BODY RETURN type=kotlin.Nothing from='public open fun bar (): kotlin.Int declared in .Test1' - CALL 'public abstract fun bar (): kotlin.Int declared in .IBase' type=kotlin.Int origin=null + CALL 'public final fun bar (): kotlin.Int declared in .BaseImpl' type=kotlin.Int origin=null $this: GET_FIELD 'FIELD DELEGATE name:<$$delegate_0> type:.BaseImpl visibility:local [final]' type=.BaseImpl origin=null receiver: GET_VAR ': .Test1 declared in .Test1.bar' type=.Test1 origin=null FUN DELEGATED_MEMBER name:qux visibility:public modality:OPEN <> ($this:.Test1, $receiver:kotlin.String) returnType:kotlin.Unit @@ -235,7 +235,7 @@ FILE fqName: fileName:/delegatedImplementation.kt $this: VALUE_PARAMETER name: type:.Test1 $receiver: VALUE_PARAMETER name: type:kotlin.String BLOCK_BODY - CALL 'public abstract fun qux (): kotlin.Unit declared in .IBase' type=kotlin.Unit origin=null + CALL 'public final fun qux (): kotlin.Unit declared in .BaseImpl' type=kotlin.Unit origin=null $this: GET_FIELD 'FIELD DELEGATE name:<$$delegate_0> type:.BaseImpl visibility:local [final]' type=.BaseImpl origin=null receiver: GET_VAR ': .Test1 declared in .Test1.qux' type=.Test1 origin=null $receiver: GET_VAR ': kotlin.String declared in .Test1.qux' type=kotlin.String origin=null @@ -268,7 +268,7 @@ FILE fqName: fileName:/delegatedImplementation.kt VALUE_PARAMETER name:x index:0 type:kotlin.Int VALUE_PARAMETER name:s index:1 type:kotlin.String BLOCK_BODY - CALL 'public abstract fun foo (x: kotlin.Int, s: kotlin.String): kotlin.Unit declared in .IBase' type=kotlin.Unit origin=null + CALL 'public final fun foo (x: kotlin.Int, s: kotlin.String): kotlin.Unit declared in .BaseImpl' type=kotlin.Unit origin=null $this: GET_FIELD 'FIELD DELEGATE name:<$$delegate_0> type:.BaseImpl visibility:local [final]' type=.BaseImpl origin=null receiver: GET_VAR ': .Test2 declared in .Test2.foo' type=.Test2 origin=null x: GET_VAR 'x: kotlin.Int declared in .Test2.foo' type=kotlin.Int origin=null @@ -279,7 +279,7 @@ FILE fqName: fileName:/delegatedImplementation.kt $this: VALUE_PARAMETER name: type:.Test2 BLOCK_BODY RETURN type=kotlin.Nothing from='public open fun bar (): kotlin.Int declared in .Test2' - CALL 'public abstract fun bar (): kotlin.Int declared in .IBase' type=kotlin.Int origin=null + CALL 'public final fun bar (): kotlin.Int declared in .BaseImpl' type=kotlin.Int origin=null $this: GET_FIELD 'FIELD DELEGATE name:<$$delegate_0> type:.BaseImpl visibility:local [final]' type=.BaseImpl origin=null receiver: GET_VAR ': .Test2 declared in .Test2.bar' type=.Test2 origin=null FUN DELEGATED_MEMBER name:qux visibility:public modality:OPEN <> ($this:.Test2, $receiver:kotlin.String) returnType:kotlin.Unit @@ -288,7 +288,7 @@ FILE fqName: fileName:/delegatedImplementation.kt $this: VALUE_PARAMETER name: type:.Test2 $receiver: VALUE_PARAMETER name: type:kotlin.String BLOCK_BODY - CALL 'public abstract fun qux (): kotlin.Unit declared in .IBase' type=kotlin.Unit origin=null + CALL 'public final fun qux (): kotlin.Unit declared in .BaseImpl' type=kotlin.Unit origin=null $this: GET_FIELD 'FIELD DELEGATE name:<$$delegate_0> type:.BaseImpl visibility:local [final]' type=.BaseImpl origin=null receiver: GET_VAR ': .Test2 declared in .Test2.qux' type=.Test2 origin=null $receiver: GET_VAR ': kotlin.String declared in .Test2.qux' type=kotlin.String origin=null diff --git a/compiler/testData/ir/irText/classes/delegatedImplementationWithExplicitOverride.fir.ir.txt b/compiler/testData/ir/irText/classes/delegatedImplementationWithExplicitOverride.fir.ir.txt index b4d1d701d00..e645ea72c6e 100644 --- a/compiler/testData/ir/irText/classes/delegatedImplementationWithExplicitOverride.fir.ir.txt +++ b/compiler/testData/ir/irText/classes/delegatedImplementationWithExplicitOverride.fir.ir.txt @@ -58,7 +58,7 @@ FILE fqName: fileName:/delegatedImplementationWithExplicitOverride.kt public abstract fun foo (): kotlin.Unit declared in .IFooBar $this: VALUE_PARAMETER name: type:.C BLOCK_BODY - CALL 'public abstract fun foo (): kotlin.Unit declared in .IFooBar' type=kotlin.Unit origin=null + CALL 'public final fun foo (): kotlin.Unit declared in .FooBarImpl' type=kotlin.Unit origin=null $this: GET_FIELD 'FIELD DELEGATE name:<$$delegate_0> type:.FooBarImpl visibility:local [final]' type=.FooBarImpl origin=null receiver: GET_VAR ': .C declared in .C.foo' type=.C origin=null FIELD DELEGATE name:<$$delegate_0> type:.FooBarImpl visibility:local [final] diff --git a/compiler/testData/ir/irText/classes/implicitNotNullOnDelegatedImplementation.fir.ir.txt b/compiler/testData/ir/irText/classes/implicitNotNullOnDelegatedImplementation.fir.ir.txt index a386a3ea3c3..019d6c07a13 100644 --- a/compiler/testData/ir/irText/classes/implicitNotNullOnDelegatedImplementation.fir.ir.txt +++ b/compiler/testData/ir/irText/classes/implicitNotNullOnDelegatedImplementation.fir.ir.txt @@ -137,7 +137,7 @@ FILE fqName: fileName:/implicitNotNullOnDelegatedImplementation.kt $this: VALUE_PARAMETER name: type:.TestJFoo BLOCK_BODY RETURN type=kotlin.Nothing from='public open fun foo (): kotlin.String declared in .TestJFoo' - CALL 'public abstract fun foo (): kotlin.String declared in .IFoo' type=kotlin.String origin=null + CALL 'public open fun foo (): @[EnhancedNullability] kotlin.String declared in .JFoo' type=kotlin.String origin=null $this: GET_FIELD 'FIELD DELEGATE name:<$$delegate_0> type:.JFoo visibility:local [final]' type=.JFoo origin=null receiver: GET_VAR ': .TestJFoo declared in .TestJFoo.foo' type=.TestJFoo origin=null FIELD DELEGATE name:<$$delegate_0> type:.JFoo visibility:local [final] @@ -168,7 +168,7 @@ FILE fqName: fileName:/implicitNotNullOnDelegatedImplementation.kt $this: VALUE_PARAMETER name: type:.TestK1 BLOCK_BODY RETURN type=kotlin.Nothing from='public open fun foo (): kotlin.String declared in .TestK1' - CALL 'public abstract fun foo (): kotlin.String declared in .IFoo' type=kotlin.String origin=null + CALL 'public open fun foo (): @[EnhancedNullability] kotlin.String [fake_override] declared in .K1' type=kotlin.String origin=null $this: GET_FIELD 'FIELD DELEGATE name:<$$delegate_0> type:.K1 visibility:local [final]' type=.K1 origin=null receiver: GET_VAR ': .TestK1 declared in .TestK1.foo' type=.TestK1 origin=null FIELD DELEGATE name:<$$delegate_0> type:.K1 visibility:local [final] @@ -199,7 +199,7 @@ FILE fqName: fileName:/implicitNotNullOnDelegatedImplementation.kt $this: VALUE_PARAMETER name: type:.TestK2 BLOCK_BODY RETURN type=kotlin.Nothing from='public open fun foo (): kotlin.String declared in .TestK2' - CALL 'public abstract fun foo (): kotlin.String declared in .IFoo' type=kotlin.String origin=null + CALL 'public final fun foo (): kotlin.String declared in .K2' type=kotlin.String origin=null $this: GET_FIELD 'FIELD DELEGATE name:<$$delegate_0> type:.K2 visibility:local [final]' type=.K2 origin=null receiver: GET_VAR ': .TestK2 declared in .TestK2.foo' type=.TestK2 origin=null FIELD DELEGATE name:<$$delegate_0> type:.K2 visibility:local [final] @@ -230,7 +230,7 @@ FILE fqName: fileName:/implicitNotNullOnDelegatedImplementation.kt $this: VALUE_PARAMETER name: type:.TestK3 BLOCK_BODY RETURN type=kotlin.Nothing from='public open fun foo (): kotlin.String declared in .TestK3' - CALL 'public abstract fun foo (): kotlin.String declared in .IFoo' type=kotlin.String origin=null + CALL 'public open fun foo (): kotlin.String [fake_override] declared in .K3' type=kotlin.String origin=null $this: GET_FIELD 'FIELD DELEGATE name:<$$delegate_0> type:.K3 visibility:local [final]' type=.K3 origin=null receiver: GET_VAR ': .TestK3 declared in .TestK3.foo' type=.TestK3 origin=null FIELD DELEGATE name:<$$delegate_0> type:.K3 visibility:local [final] @@ -261,7 +261,7 @@ FILE fqName: fileName:/implicitNotNullOnDelegatedImplementation.kt $this: VALUE_PARAMETER name: type:.TestK4 BLOCK_BODY RETURN type=kotlin.Nothing from='public open fun foo (): kotlin.String declared in .TestK4' - CALL 'public abstract fun foo (): kotlin.String declared in .IFoo' type=kotlin.String origin=null + CALL 'public final fun foo (): @[FlexibleNullability] kotlin.String? declared in .K4' type=kotlin.String origin=null $this: GET_FIELD 'FIELD DELEGATE name:<$$delegate_0> type:.K4 visibility:local [final]' type=.K4 origin=null receiver: GET_VAR ': .TestK4 declared in .TestK4.foo' type=.TestK4 origin=null FIELD DELEGATE name:<$$delegate_0> type:.K4 visibility:local [final] diff --git a/compiler/testData/ir/irText/classes/kt45934.fir.ir.txt b/compiler/testData/ir/irText/classes/kt45934.fir.ir.txt index 40b4dee4d57..298bec2fe6a 100644 --- a/compiler/testData/ir/irText/classes/kt45934.fir.ir.txt +++ b/compiler/testData/ir/irText/classes/kt45934.fir.ir.txt @@ -13,8 +13,7 @@ FILE fqName: fileName:/kt45934.kt $this: VALUE_PARAMETER name: type:.C BLOCK_BODY RETURN type=kotlin.Nothing from='public open fun foo (): @[FlexibleNullability] kotlin.collections.List<@[FlexibleNullability] C of .C.foo?>? declared in .C' - CALL 'public abstract fun foo (): @[FlexibleNullability] kotlin.collections.List<@[FlexibleNullability] C of .I.foo?>? declared in .I' type=@[FlexibleNullability] kotlin.collections.List<@[FlexibleNullability] C of .C.foo?>? origin=null - : C of .C.foo + CALL 'public open fun foo (): @[FlexibleNullability] kotlin.collections.List<@[FlexibleNullability] kotlin.String?>? declared in .J' type=@[FlexibleNullability] kotlin.collections.List<@[FlexibleNullability] C of .C.foo?>? origin=null $this: GET_FIELD 'FIELD DELEGATE name:<$$delegate_0> type:.J visibility:local [final]' type=.J origin=null receiver: GET_VAR ': .C declared in .C.foo' type=.C origin=null FIELD DELEGATE name:<$$delegate_0> type:.J visibility:local [final] diff --git a/compiler/testData/ir/irText/types/nullChecks/nullCheckOnInterfaceDelegation.fir.ir.txt b/compiler/testData/ir/irText/types/nullChecks/nullCheckOnInterfaceDelegation.fir.ir.txt index 0774a6e6e1a..8e9b196bfcc 100644 --- a/compiler/testData/ir/irText/types/nullChecks/nullCheckOnInterfaceDelegation.fir.ir.txt +++ b/compiler/testData/ir/irText/types/nullChecks/nullCheckOnInterfaceDelegation.fir.ir.txt @@ -61,7 +61,7 @@ FILE fqName: fileName:/nullCheckOnInterfaceDelegation.kt $this: VALUE_PARAMETER name: type:.Delegated BLOCK_BODY RETURN type=kotlin.Nothing from='public open fun foo (): kotlin.String declared in .Delegated' - CALL 'public abstract fun foo (): kotlin.String declared in .IFoo' type=kotlin.String origin=null + CALL 'public final fun foo (): @[FlexibleNullability] kotlin.String? declared in .Derived' type=kotlin.String origin=null $this: GET_FIELD 'FIELD DELEGATE name:<$$delegate_0> type:.Derived visibility:local [final]' type=.Derived origin=null receiver: GET_VAR ': .Delegated declared in .Delegated.foo' type=.Delegated origin=null FIELD DELEGATE name:<$$delegate_0> type:.Derived visibility:local [final]