From d4b0688690b2e291de060c1bf393217e38ae0f0c Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Tue, 2 Feb 2021 17:51:11 +0300 Subject: [PATCH] FIR: introduce delegate field initializers Before this commit we initialized delegate fields in primary constructor, that could provoke NPE in case delegate is used in initializer of some property backing field. Now we initialize delegate fields directly instead. --- .../resolve/delegatedSuperType.fir.txt | 5 +- .../anonymousObjectByDelegate.fir.txt | 10 +- .../diagnostics/delegationInInterface.fir.txt | 4 +- .../diagnostics/delegationInInterface.kt | 2 +- .../superCallWithDelegation.fir.txt | 5 +- .../kotlin/fir/backend/Fir2IrConverter.kt | 10 +- .../fir/backend/Fir2IrDeclarationStorage.kt | 11 +- .../kotlin/fir/backend/Fir2IrVisitor.kt | 4 +- .../generators/ClassMemberGenerator.kt | 12 ++ .../FirBlackBoxCodegenTestGenerated.java | 6 + .../runners/ir/Fir2IrTextTestGenerated.java | 6 + .../fir/java/declarations/FirJavaField.kt | 1 - .../converter/DeclarationsConverter.kt | 93 ++------- .../kotlin/fir/builder/RawFirBuilder.kt | 67 ++----- .../fir/resolve/dfa/FirDataFlowAnalyzer.kt | 12 ++ .../kotlin/fir/resolve/dfa/cfg/CFGNode.kt | 21 +++ .../fir/resolve/dfa/cfg/CFGNodeRenderer.kt | 2 + .../fir/resolve/dfa/cfg/ControlFlowGraph.kt | 1 + .../dfa/cfg/ControlFlowGraphBuilder.kt | 31 ++- .../dfa/cfg/ControlFlowGraphNodeBuilder.kt | 6 + .../dfa/cfg/ControlFlowGraphVisitor.kt | 10 + .../transformers/FirTypeResolveTransformer.kt | 13 +- .../body/resolve/FirBodyResolveTransformer.kt | 4 + .../FirDeclarationsResolveTransformer.kt | 30 +++ .../FirContractResolveTransformer.kt | 5 + .../impl/FirClassDeclaredMemberScope.kt | 2 +- .../declarations/builder/FirFieldBuilder.kt | 2 + .../fir/declarations/impl/FirFieldImpl.kt | 9 +- .../generator/ImplementationConfigurator.kt | 2 +- .../box/fir/Fir2IrClassifierStorage.kt | 28 +++ .../delegatedGenericImplementation.fir.kt.txt | 15 +- .../delegatedGenericImplementation.fir.txt | 48 +++-- .../delegatedImplementation.fir.kt.txt | 9 +- .../classes/delegatedImplementation.fir.txt | 19 +- ...edImplementationOfJavaInterface.fir.kt.txt | 10 +- ...gatedImplementationOfJavaInterface.fir.txt | 27 ++- ...lementationWithExplicitOverride.fir.kt.txt | 8 +- ...ImplementationWithExplicitOverride.fir.txt | 15 +- ...otNullOnDelegatedImplementation.fir.kt.txt | 15 +- ...itNotNullOnDelegatedImplementation.fir.txt | 25 +-- .../annotationsOnDelegatedMembers.fir.kt.txt | 3 +- .../annotationsOnDelegatedMembers.fir.txt | 5 +- .../inheritingDeprecation.fir.kt.txt | 3 +- .../annotations/inheritingDeprecation.fir.txt | 5 +- .../ir/irText/declarations/kt35550.fir.kt.txt | 3 +- .../ir/irText/declarations/kt35550.fir.txt | 5 +- .../parameters/delegatedMembers.fir.kt.txt | 3 +- .../parameters/delegatedMembers.fir.txt | 5 +- .../firProblems/AnnotationLoader.fir.kt.txt | 8 +- .../firProblems/AnnotationLoader.fir.txt | 15 +- ...elegationAndInheritanceFromJava.fir.kt.txt | 3 +- .../DelegationAndInheritanceFromJava.fir.txt | 5 +- .../Fir2IrClassifierStorage.fir.kt.txt | 66 +++++++ .../Fir2IrClassifierStorage.fir.txt | 176 ++++++++++++++++++ .../firProblems/Fir2IrClassifierStorage.kt | 18 ++ .../Fir2IrClassifierStorage.kt.txt | 65 +++++++ .../firProblems/Fir2IrClassifierStorage.txt | 173 +++++++++++++++++ .../firProblems/SignatureClash.fir.kt.txt | 11 +- .../irText/firProblems/SignatureClash.fir.txt | 23 ++- .../ir/irText/firProblems/kt43342.fir.kt.txt | 10 +- .../ir/irText/firProblems/kt43342.fir.txt | 27 ++- .../irText/types/javaWildcardType.fir.kt.txt | 6 +- .../ir/irText/types/javaWildcardType.fir.txt | 10 +- .../types/rawTypeInSignature.fir.kt.txt | 3 +- .../irText/types/rawTypeInSignature.fir.txt | 5 +- .../codegen/BlackBoxCodegenTestGenerated.java | 6 + .../IrBlackBoxCodegenTestGenerated.java | 6 + .../test/runners/ir/IrTextTestGenerated.java | 6 + .../LightAnalysisModeTestGenerated.java | 5 + 69 files changed, 928 insertions(+), 356 deletions(-) create mode 100644 compiler/testData/codegen/box/fir/Fir2IrClassifierStorage.kt create mode 100644 compiler/testData/ir/irText/firProblems/Fir2IrClassifierStorage.fir.kt.txt create mode 100644 compiler/testData/ir/irText/firProblems/Fir2IrClassifierStorage.fir.txt create mode 100644 compiler/testData/ir/irText/firProblems/Fir2IrClassifierStorage.kt create mode 100644 compiler/testData/ir/irText/firProblems/Fir2IrClassifierStorage.kt.txt create mode 100644 compiler/testData/ir/irText/firProblems/Fir2IrClassifierStorage.txt diff --git a/compiler/fir/analysis-tests/testData/resolve/delegatedSuperType.fir.txt b/compiler/fir/analysis-tests/testData/resolve/delegatedSuperType.fir.txt index 44fedf60655..750ae3ad097 100644 --- a/compiler/fir/analysis-tests/testData/resolve/delegatedSuperType.fir.txt +++ b/compiler/fir/analysis-tests/testData/resolve/delegatedSuperType.fir.txt @@ -13,13 +13,12 @@ FILE: delegatedSuperType.kt } public final class C : R|A| { - local final field <$$delegate_0>: R|A| - public constructor(b: R|B|): R|C| { super() - this@R|/C|.R|/<$$delegate_0>| = R|/b| } + local final field <$$delegate_0>: R|A| = R|/b| + public final val b: R|B| = R|/b| public get(): R|B| diff --git a/compiler/fir/analysis-tests/testData/resolve/diagnostics/anonymousObjectByDelegate.fir.txt b/compiler/fir/analysis-tests/testData/resolve/diagnostics/anonymousObjectByDelegate.fir.txt index d83ecbdb10b..cc3f18011e9 100644 --- a/compiler/fir/analysis-tests/testData/resolve/diagnostics/anonymousObjectByDelegate.fir.txt +++ b/compiler/fir/analysis-tests/testData/resolve/diagnostics/anonymousObjectByDelegate.fir.txt @@ -9,25 +9,23 @@ FILE: anonymousObjectByDelegate.kt } public final fun R|A|.test_1(): R|kotlin/Unit| { object : R|B| { - local final field <$$delegate_0>: R|B| - private constructor(): R|| { super() - this@R|/|.R|/<$$delegate_0>| = this@R|/test_1|.R|/A.b| } + local final field <$$delegate_0>: R|B| = this@R|/test_1|.R|/A.b| + } } public final fun R|A|.test_2(): R|kotlin/Unit| { object : R|B| { - local final field <$$delegate_0>: R|B| - private constructor(): R|| { super() - this@R|/|.R|/<$$delegate_0>| = this@R|/test_2|.R|/A.b| } + local final field <$$delegate_0>: R|B| = this@R|/test_2|.R|/A.b| + } } diff --git a/compiler/fir/analysis-tests/testData/resolve/diagnostics/delegationInInterface.fir.txt b/compiler/fir/analysis-tests/testData/resolve/diagnostics/delegationInInterface.fir.txt index daa35ef4ecf..9c39bfa07c9 100644 --- a/compiler/fir/analysis-tests/testData/resolve/diagnostics/delegationInInterface.fir.txt +++ b/compiler/fir/analysis-tests/testData/resolve/diagnostics/delegationInInterface.fir.txt @@ -6,7 +6,7 @@ FILE: delegationInInterface.kt } public abstract interface B : R|A| { - local final field <$$delegate_0>: R|A| + local final field <$$delegate_0>: R|A| = # public abstract val a: R|A| public get(): R|A| @@ -15,6 +15,6 @@ FILE: delegationInInterface.kt public final val test: R|A| = R|/A.A|() public get(): R|A| public abstract interface C : R|A| { - local final field <$$delegate_0>: R|A| + local final field <$$delegate_0>: R|A| = R|/test| } diff --git a/compiler/fir/analysis-tests/testData/resolve/diagnostics/delegationInInterface.kt b/compiler/fir/analysis-tests/testData/resolve/diagnostics/delegationInInterface.kt index b212a508b3c..cd5318b99c4 100644 --- a/compiler/fir/analysis-tests/testData/resolve/diagnostics/delegationInInterface.kt +++ b/compiler/fir/analysis-tests/testData/resolve/diagnostics/delegationInInterface.kt @@ -1,6 +1,6 @@ class A -interface B : A by a { +interface B : A by a { val a: A } diff --git a/compiler/fir/analysis-tests/testData/resolve/diagnostics/superCallWithDelegation.fir.txt b/compiler/fir/analysis-tests/testData/resolve/diagnostics/superCallWithDelegation.fir.txt index 728990c69a9..c761b0afb53 100644 --- a/compiler/fir/analysis-tests/testData/resolve/diagnostics/superCallWithDelegation.fir.txt +++ b/compiler/fir/analysis-tests/testData/resolve/diagnostics/superCallWithDelegation.fir.txt @@ -4,13 +4,12 @@ FILE: superCallWithDelegation.kt } public open class B : R|A| { - local final field <$$delegate_0>: R|A| - public constructor(a: R|A|): R|B| { super() - this@R|/B|.R|/<$$delegate_0>| = R|/a| } + local final field <$$delegate_0>: R|A| = R|/a| + private final val a: R|A| = R|/a| private get(): R|A| diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrConverter.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrConverter.kt index a07d8e84ec4..dcb27fa4ade 100644 --- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrConverter.kt +++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrConverter.kt @@ -93,7 +93,7 @@ class Fir2IrConverter( } val processedCallableNames = mutableSetOf() val classes = mutableListOf() - for (declaration in sortBySynthetic(anonymousObject.declarations)) { + for (declaration in syntheticPropertiesLast(anonymousObject.declarations)) { val irDeclaration = if (declaration is FirRegularClass) { classes += declaration registerClassAndNestedClasses(declaration, irClass) @@ -129,7 +129,7 @@ class Fir2IrConverter( irClass.declarations += irConstructor } val allDeclarations = regularClass.declarations.toMutableList() - for (declaration in sortBySynthetic(regularClass.declarations)) { + for (declaration in syntheticPropertiesLast(regularClass.declarations)) { val irDeclaration = processMemberDeclaration(declaration, regularClass, irClass) ?: continue irClass.declarations += irDeclaration } @@ -167,8 +167,8 @@ class Fir2IrConverter( // Sort declarations so that all non-synthetic declarations are before synthetic ones. // This is needed because converting synthetic fields for implementation delegation needs to know // existing declarations in the class to avoid adding redundant delegated members. - private fun sortBySynthetic(declarations: List): Iterable { - return declarations.sortedBy { it.isSynthetic } + private fun syntheticPropertiesLast(declarations: List): Iterable { + return declarations.sortedBy { it !is FirField && it.isSynthetic } } private fun registerClassAndNestedClasses(regularClass: FirRegularClass, parent: IrDeclarationParent): IrClass { @@ -273,7 +273,7 @@ class Fir2IrConverter( val classifierStorage = Fir2IrClassifierStorage(components) val converter = Fir2IrConverter(moduleDescriptor, sourceManager, components) val fir2irVisitor = Fir2IrVisitor(converter, components, conversionScope) - val declarationStorage = Fir2IrDeclarationStorage(components, fir2irVisitor, moduleDescriptor) + val declarationStorage = Fir2IrDeclarationStorage(components, moduleDescriptor) val typeConverter = Fir2IrTypeConverter(components) val builtIns = Fir2IrBuiltIns(components, specialSymbolProvider) val annotationGenerator = AnnotationGenerator(components) 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 d1c4e41dcb1..5e82c4488ff 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 @@ -39,7 +39,6 @@ import org.jetbrains.kotlin.ir.builders.declarations.UNDEFINED_PARAMETER_INDEX import org.jetbrains.kotlin.ir.declarations.* import org.jetbrains.kotlin.ir.declarations.impl.IrVariableImpl import org.jetbrains.kotlin.ir.declarations.lazy.IrLazyClass -import org.jetbrains.kotlin.ir.descriptors.* import org.jetbrains.kotlin.ir.expressions.IrExpression import org.jetbrains.kotlin.ir.expressions.IrSyntheticBodyKind import org.jetbrains.kotlin.ir.expressions.impl.IrErrorExpressionImpl @@ -56,7 +55,6 @@ import org.jetbrains.kotlin.serialization.deserialization.descriptors.Deserializ @OptIn(ObsoleteDescriptorBasedAPI::class) class Fir2IrDeclarationStorage( private val components: Fir2IrComponents, - private val visitor: Fir2IrVisitor, private val moduleDescriptor: FirModuleDescriptor ) : Fir2IrComponents by components { @@ -850,12 +848,11 @@ class Fir2IrDeclarationStorage( isExternal = false, isStatic = field.isStatic ).apply { - field.initializer?.let { - val expression = visitor.convertToIrExpression(it) - expression.type = type - initializer = irFactory.createExpressionBody(expression) - } fieldCache[field] = this + val initializer = field.initializer + if (initializer is FirConstExpression<*>) { + this.initializer = factory.createExpressionBody(initializer.toIrConst(type)) + } } } } 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 b6f40c35c39..84ae8b8a250 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 @@ -67,7 +67,9 @@ class Fir2IrVisitor( override fun visitField(field: FirField, data: Any?): IrField { if (field.isSynthetic) { - return declarationStorage.getCachedIrField(field)!! + return declarationStorage.getCachedIrField(field)!!.apply { + memberGenerator.convertFieldContent(this, field) + } } else { throw AssertionError("Unexpected field: ${field.render()}") } diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/ClassMemberGenerator.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/ClassMemberGenerator.kt index aa43ea3c266..0b709411cfb 100644 --- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/ClassMemberGenerator.kt +++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/ClassMemberGenerator.kt @@ -174,6 +174,18 @@ internal class ClassMemberGenerator( return irProperty } + fun convertFieldContent(irField: IrField, field: FirField): IrField { + conversionScope.withParent(irField) { + declarationStorage.enterScope(irField) + val initializerExpression = field.initializer + if (irField.initializer == null && initializerExpression != null) { + irField.initializer = irFactory.createExpressionBody(visitor.convertToIrExpression(initializerExpression)) + } + declarationStorage.leaveScope(irField) + } + return irField + } + private fun IrProperty.initializeBackingField( property: FirProperty, initializerExpression: FirExpression? diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java index 70f85227e17..2bea9176c2b 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java @@ -14840,6 +14840,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTest("compiler/testData/codegen/box/fir/FakeOverrideBuilder.kt"); } + @Test + @TestMetadata("Fir2IrClassifierStorage.kt") + public void testFir2IrClassifierStorage() throws Exception { + runTest("compiler/testData/codegen/box/fir/Fir2IrClassifierStorage.kt"); + } + @Test @TestMetadata("IrBuiltIns.kt") public void testIrBuiltIns() throws Exception { diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/ir/Fir2IrTextTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/ir/Fir2IrTextTestGenerated.java index 7bd135d100f..6c0c63e55c0 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/ir/Fir2IrTextTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/ir/Fir2IrTextTestGenerated.java @@ -2116,6 +2116,12 @@ public class Fir2IrTextTestGenerated extends AbstractFir2IrTextTest { runTest("compiler/testData/ir/irText/firProblems/deprecated.kt"); } + @Test + @TestMetadata("Fir2IrClassifierStorage.kt") + public void testFir2IrClassifierStorage() throws Exception { + runTest("compiler/testData/ir/irText/firProblems/Fir2IrClassifierStorage.kt"); + } + @Test @TestMetadata("FirBuilder.kt") public void testFirBuilder() throws Exception { diff --git a/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/declarations/FirJavaField.kt b/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/declarations/FirJavaField.kt index e2c5c420af1..723e21bf066 100644 --- a/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/declarations/FirJavaField.kt +++ b/compiler/fir/java/src/org/jetbrains/kotlin/fir/java/declarations/FirJavaField.kt @@ -148,7 +148,6 @@ internal class FirJavaFieldBuilder : FirFieldBuilder() { var modality: Modality? = null lateinit var visibility: Visibility var isStatic: Boolean by Delegates.notNull() - var initializer: FirExpression? = null lateinit var annotationBuilder: () -> List override var resolvePhase: FirResolvePhase = FirResolvePhase.ANALYZED_DEPENDENCIES diff --git a/compiler/fir/raw-fir/light-tree2fir/src/org/jetbrains/kotlin/fir/lightTree/converter/DeclarationsConverter.kt b/compiler/fir/raw-fir/light-tree2fir/src/org/jetbrains/kotlin/fir/lightTree/converter/DeclarationsConverter.kt index 283b1afb22b..e4acbaa0b71 100644 --- a/compiler/fir/raw-fir/light-tree2fir/src/org/jetbrains/kotlin/fir/lightTree/converter/DeclarationsConverter.kt +++ b/compiler/fir/raw-fir/light-tree2fir/src/org/jetbrains/kotlin/fir/lightTree/converter/DeclarationsConverter.kt @@ -37,12 +37,9 @@ import org.jetbrains.kotlin.fir.lightTree.fir.modifier.Modifier import org.jetbrains.kotlin.fir.lightTree.fir.modifier.TypeModifier import org.jetbrains.kotlin.fir.lightTree.fir.modifier.TypeParameterModifier import org.jetbrains.kotlin.fir.lightTree.fir.modifier.TypeProjectionModifier -import org.jetbrains.kotlin.fir.references.builder.buildImplicitThisReference -import org.jetbrains.kotlin.fir.references.builder.buildResolvedNamedReference import org.jetbrains.kotlin.fir.references.builder.buildSimpleNamedReference import org.jetbrains.kotlin.fir.references.impl.FirReferencePlaceholderForResolvedAnnotations import org.jetbrains.kotlin.fir.scopes.FirScopeProvider -import org.jetbrains.kotlin.fir.symbols.AbstractFirBasedSymbol import org.jetbrains.kotlin.fir.symbols.CallableId import org.jetbrains.kotlin.fir.symbols.LocalCallableIdConstructor import org.jetbrains.kotlin.fir.symbols.impl.* @@ -432,10 +429,9 @@ class DeclarationsConverter( val selfType = classNode.toDelegatedSelfType(this) registerSelfType(selfType) - val delegationSpecifiers = superTypeList?.let { convertDelegationSpecifiers(it, symbol, selfType) } + val delegationSpecifiers = superTypeList?.let { convertDelegationSpecifiers(it) } var delegatedSuperTypeRef: FirTypeRef? = delegationSpecifiers?.delegatedSuperTypeRef val delegatedConstructorSource: FirLightSourceElement? = delegationSpecifiers?.delegatedConstructorSource - delegationSpecifiers?.delegateFields?.map { declarations += it } val superTypeCallEntry = delegationSpecifiers?.delegatedConstructorArguments.orEmpty() val superTypeRefs = mutableListOf() @@ -479,11 +475,11 @@ class DeclarationsConverter( ) //parse primary constructor val primaryConstructorWrapper = convertPrimaryConstructor( - primaryConstructor, selfType.source, classWrapper, delegatedConstructorSource, - delegationSpecifiers?.primaryConstructorBody + primaryConstructor, selfType.source, classWrapper, delegatedConstructorSource ) val firPrimaryConstructor = primaryConstructorWrapper?.firConstructor firPrimaryConstructor?.let { declarations += it } + delegationSpecifiers?.delegateFields?.map { declarations += it } val properties = mutableListOf() if (primaryConstructor != null && firPrimaryConstructor != null) { @@ -558,19 +554,17 @@ class DeclarationsConverter( var classBody: LighterASTNode? = null var delegatedConstructorSource: FirLightSourceElement? = null var delegateFields: List? = null - var primaryConstructorBody: FirBlock? = null objectLiteral.getChildNodesByType(OBJECT_DECLARATION).first().forEachChildren { when (it.tokenType) { MODIFIER_LIST -> modifiers = convertModifierList(it) PRIMARY_CONSTRUCTOR -> primaryConstructor = it - SUPER_TYPE_LIST -> convertDelegationSpecifiers(it, symbol, delegatedSelfType).let { - delegatedSuperTypeRef = it.delegatedSuperTypeRef - superTypeRefs += it.superTypesRef - superTypeCallEntry += it.delegatedConstructorArguments - delegatedConstructorSource = it.delegatedConstructorSource - delegateFields = it.delegateFields - primaryConstructorBody = it.primaryConstructorBody + SUPER_TYPE_LIST -> convertDelegationSpecifiers(it).let { specifiers -> + delegatedSuperTypeRef = specifiers.delegatedSuperTypeRef + superTypeRefs += specifiers.superTypesRef + superTypeCallEntry += specifiers.delegatedConstructorArguments + delegatedConstructorSource = specifiers.delegatedConstructorSource + delegateFields = specifiers.delegateFields } CLASS_BODY -> classBody = it } @@ -586,7 +580,6 @@ class DeclarationsConverter( this.superTypeRefs += superTypeRefs typeRef = delegatedSelfType - delegateFields?.map { this.declarations += it } val classWrapper = ClassWrapper( SpecialNames.NO_NAME_PROVIDED, modifiers, ClassKind.OBJECT, this, hasPrimaryConstructor = false, @@ -597,8 +590,10 @@ class DeclarationsConverter( superTypeCallEntry = superTypeCallEntry ) //parse primary constructor - convertPrimaryConstructor(primaryConstructor, typeRef.source, classWrapper, delegatedConstructorSource, primaryConstructorBody) - ?.let { this.declarations += it.firConstructor } + convertPrimaryConstructor( + primaryConstructor, typeRef.source, classWrapper, delegatedConstructorSource + )?.let { this.declarations += it.firConstructor } + delegateFields?.let { this.declarations += it } //parse declarations classBody?.let { @@ -724,7 +719,6 @@ class DeclarationsConverter( selfTypeSource: FirSourceElement?, classWrapper: ClassWrapper, delegatedConstructorSource: FirLightSourceElement?, - body: FirBlock? = null ): PrimaryConstructor? { if (primaryConstructor == null && !classWrapper.isEnumEntry() && classWrapper.hasSecondaryConstructor) return null if (classWrapper.isInterface()) return null @@ -768,7 +762,7 @@ class DeclarationsConverter( typeParameters += constructorTypeParametersFromConstructedClass(classWrapper.classBuilder.typeParameters) this.valueParameters += valueParameters.map { it.firValueParameter } delegatedConstructor = firDelegatedCall - this.body = body + this.body = null }.apply { containingClassAttr = currentDispatchReceiverType()!!.lookupTag }, valueParameters @@ -1437,21 +1431,14 @@ class DeclarationsConverter( val delegatedConstructorArguments: List, val delegatedConstructorSource: FirLightSourceElement?, val delegateFields: List, - val primaryConstructorBody: FirBlock? ) - private fun convertDelegationSpecifiers( - delegationSpecifiers: LighterASTNode, - containerSymbol: AbstractFirBasedSymbol<*>, - delegatedTypeRef: FirTypeRef - ): DelegationSpecifiers { + private fun convertDelegationSpecifiers(delegationSpecifiers: LighterASTNode): DelegationSpecifiers { val superTypeRefs = mutableListOf() val superTypeCallEntry = mutableListOf() var delegatedSuperTypeRef: FirTypeRef? = null var delegateConstructorSource: FirLightSourceElement? = null val delegateFields = mutableListOf() - val initializeDelegateStatements = mutableListOf() - var delegateNumber = 0 delegationSpecifiers.forEachChildren { when (it.tokenType) { SUPER_TYPE_ENTRY -> { @@ -1464,28 +1451,12 @@ class DeclarationsConverter( delegateConstructorSource = it.toFirSourceElement(FirFakeSourceElementKind.DelegatingConstructorCall) } DELEGATED_SUPER_TYPE_ENTRY -> { - superTypeRefs += convertExplicitDelegation( - it, - delegateNumber, - delegateFields, - initializeDelegateStatements, - containerSymbol, - delegatedTypeRef - ) - delegateNumber++ + superTypeRefs += convertExplicitDelegation(it, delegateFields) } } } - val body = if (initializeDelegateStatements.isNotEmpty()) { - buildBlock { - for (statement in initializeDelegateStatements) { - statements += statement - } - } - } else null return DelegationSpecifiers( - delegatedSuperTypeRef, superTypeRefs, superTypeCallEntry, delegateConstructorSource, - delegateFields, body + delegatedSuperTypeRef, superTypeRefs, superTypeCallEntry, delegateConstructorSource, delegateFields ) } @@ -1515,14 +1486,7 @@ class DeclarationsConverter( * : userType "by" element * ; */ - private fun convertExplicitDelegation( - explicitDelegation: LighterASTNode, - delegateNumber: Int, - delegateFields: MutableList, - initializeDelegateStatements: MutableList, - containerSymbol: AbstractFirBasedSymbol<*>, - delegatedSelfTypeRef: FirTypeRef - ): FirTypeRef { + private fun convertExplicitDelegation(explicitDelegation: LighterASTNode, delegateFields: MutableList): FirTypeRef { lateinit var firTypeRef: FirTypeRef var firExpression: FirExpression? = buildErrorExpression( explicitDelegation.toFirSourceElement(), ConeSimpleDiagnostic("Should have delegate", DiagnosticKind.Syntax) @@ -1534,7 +1498,7 @@ class DeclarationsConverter( } } - val delegateName = Name.special("<\$\$delegate_$delegateNumber>") + val delegateName = Name.special("<\$\$delegate_${delegateFields.size}>") delegateFields.add( buildField { source = firExpression!!.source @@ -1545,24 +1509,7 @@ class DeclarationsConverter( symbol = FirFieldSymbol(@OptIn(LocalCallableIdConstructor::class) CallableId(name)) isVar = false status = FirDeclarationStatusImpl(Visibilities.Local, Modality.FINAL) - } - ) - initializeDelegateStatements.add( - buildVariableAssignment { - source = firExpression!!.source - calleeReference = - buildResolvedNamedReference { - name = delegateName - resolvedSymbol = delegateFields[delegateNumber].symbol - } - rValue = firExpression!! - dispatchReceiver = buildThisReceiverExpression { - source = firExpression!!.source - calleeReference = buildImplicitThisReference { - boundSymbol = containerSymbol - } - typeRef = delegatedSelfTypeRef - } + initializer = firExpression } ) return firTypeRef diff --git a/compiler/fir/raw-fir/psi2fir/src/org/jetbrains/kotlin/fir/builder/RawFirBuilder.kt b/compiler/fir/raw-fir/psi2fir/src/org/jetbrains/kotlin/fir/builder/RawFirBuilder.kt index 7c23143efdb..3959e85a96a 100644 --- a/compiler/fir/raw-fir/psi2fir/src/org/jetbrains/kotlin/fir/builder/RawFirBuilder.kt +++ b/compiler/fir/raw-fir/psi2fir/src/org/jetbrains/kotlin/fir/builder/RawFirBuilder.kt @@ -28,7 +28,6 @@ import org.jetbrains.kotlin.fir.expressions.builder.* import org.jetbrains.kotlin.fir.expressions.impl.FirSingleExpressionBlock import org.jetbrains.kotlin.fir.references.builder.* import org.jetbrains.kotlin.fir.scopes.FirScopeProvider -import org.jetbrains.kotlin.fir.symbols.AbstractFirBasedSymbol import org.jetbrains.kotlin.fir.symbols.CallableId import org.jetbrains.kotlin.fir.symbols.LocalCallableIdConstructor import org.jetbrains.kotlin.fir.symbols.impl.* @@ -544,13 +543,11 @@ class RawFirBuilder( delegatedSelfTypeRef: FirTypeRef?, delegatedEnumSuperTypeRef: FirTypeRef?, classKind: ClassKind, - containerTypeParameters: List, - containerSymbol: AbstractFirBasedSymbol<*> + containerTypeParameters: List ): FirTypeRef { var superTypeCallEntry: KtSuperTypeCallEntry? = null var delegatedSuperTypeRef: FirTypeRef? = null - var delegateNumber = 0 - val initializeDelegateStatements = mutableListOf() + val delegateFields = mutableListOf() for (superTypeListEntry in superTypeListEntries) { when (superTypeListEntry) { is KtSuperTypeEntry -> { @@ -565,7 +562,7 @@ class RawFirBuilder( val type = superTypeListEntry.typeReference.toFirOrErrorType() val delegateExpression = { superTypeListEntry.delegateExpression }.toFirExpression("Should have delegate") container.superTypeRefs += type - val delegateName = Name.special("<\$\$delegate_$delegateNumber>") + val delegateName = Name.special("<\$\$delegate_${delegateFields.size}>") val delegateSource = superTypeListEntry.delegateExpression?.toFirSourceElement() val delegateField = buildField { source = delegateSource @@ -576,28 +573,9 @@ class RawFirBuilder( symbol = FirFieldSymbol(@OptIn(LocalCallableIdConstructor::class) CallableId(name)) isVar = false status = FirDeclarationStatusImpl(Visibilities.Local, Modality.FINAL) + initializer = delegateExpression } - initializeDelegateStatements.add( - buildVariableAssignment { - source = delegateSource - calleeReference = - buildResolvedNamedReference { - source = delegateSource - name = delegateName - resolvedSymbol = delegateField.symbol - } - rValue = delegateExpression - dispatchReceiver = buildThisReceiverExpression { - source = delegateSource - calleeReference = buildImplicitThisReference { - boundSymbol = containerSymbol - } - delegatedSelfTypeRef?.let { typeRef = it } - } - } - ) - container.declarations.add(delegateField) - delegateNumber++ + delegateFields.add(delegateField) } } } @@ -637,27 +615,22 @@ class RawFirBuilder( container.superTypeRefs += implicitAnyType delegatedSuperTypeRef = implicitAnyType } - if (this is KtClass && this.isInterface()) return delegatedSuperTypeRef ?: implicitAnyType // TODO: in case we have no primary constructor, // it may be not possible to determine delegated super type right here delegatedSuperTypeRef = delegatedSuperTypeRef ?: defaultDelegatedSuperTypeRef - if (!this.hasPrimaryConstructor()) return delegatedSuperTypeRef - - val firPrimaryConstructor = primaryConstructor.toFirConstructor( - superTypeCallEntry, - delegatedSuperTypeRef, - delegatedSelfTypeRef ?: delegatedSuperTypeRef, - owner = this, - containerTypeParameters, - body = if (initializeDelegateStatements.isNotEmpty()) buildBlock { - for (statement in initializeDelegateStatements) { - statements += statement - } - } else null - ) - - container.declarations += firPrimaryConstructor + if ((this !is KtClass || !this.isInterface()) && this.hasPrimaryConstructor()) { + val firPrimaryConstructor = primaryConstructor.toFirConstructor( + superTypeCallEntry, + delegatedSuperTypeRef, + delegatedSelfTypeRef ?: delegatedSuperTypeRef, + owner = this, + containerTypeParameters, + body = null + ) + container.declarations += firPrimaryConstructor + } + container.declarations += delegateFields return delegatedSuperTypeRef } @@ -861,8 +834,7 @@ class RawFirBuilder( delegatedSelfType, null, classKind, - typeParameters, - symbol + typeParameters ) val primaryConstructor = classOrObject.primaryConstructor @@ -947,8 +919,7 @@ class RawFirBuilder( delegatedSelfType, null, ClassKind.CLASS, - containerTypeParameters = emptyList(), - symbol + containerTypeParameters = emptyList() ) typeRef = delegatedSelfType diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/FirDataFlowAnalyzer.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/FirDataFlowAnalyzer.kt index 58e5d30c9b8..6d3b14621f3 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/FirDataFlowAnalyzer.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/FirDataFlowAnalyzer.kt @@ -268,6 +268,18 @@ abstract class FirDataFlowAnalyzer( return graph } + // ----------------------------------- Field ----------------------------------- + + fun enterField(field: FirField) { + graphBuilder.enterField(field)?.mergeIncomingFlow() + } + + fun exitField(field: FirField): ControlFlowGraph? { + val (node, graph) = graphBuilder.exitField(field) ?: return null + node.mergeIncomingFlow() + return graph + } + // ----------------------------------- Delegate ----------------------------------- fun enterDelegateExpression() { diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/cfg/CFGNode.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/cfg/CFGNode.kt index 2a81173d62d..d344fd43af6 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/cfg/CFGNode.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/cfg/CFGNode.kt @@ -280,6 +280,27 @@ class PropertyInitializerExitNode(owner: ControlFlowGraph, override val fir: Fir } } +// ----------------------------------- Field ----------------------------------- + +class FieldInitializerEnterNode(owner: ControlFlowGraph, override val fir: FirField, level: Int, id: Int) : CFGNode(owner, level, id), EnterNodeMarker { + init { + owner.enterNode = this + } + + override fun accept(visitor: ControlFlowGraphVisitor, data: D): R { + return visitor.visitFieldInitializerEnterNode(this, data) + } +} +class FieldInitializerExitNode(owner: ControlFlowGraph, override val fir: FirField, level: Int, id: Int) : CFGNode(owner, level, id), ExitNodeMarker { + init { + owner.exitNode = this + } + + override fun accept(visitor: ControlFlowGraphVisitor, data: D): R { + return visitor.visitFieldInitializerExitNode(this, data) + } +} + // ----------------------------------- Init ----------------------------------- class InitBlockEnterNode(owner: ControlFlowGraph, override val fir: FirAnonymousInitializer, level: Int, id: Int) : CFGNode(owner, level, id), EnterNodeMarker { diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/cfg/CFGNodeRenderer.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/cfg/CFGNodeRenderer.kt index 9dd65782c22..f73f78bf965 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/cfg/CFGNodeRenderer.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/cfg/CFGNodeRenderer.kt @@ -85,6 +85,8 @@ fun CFGNode<*>.render(): String = is PartOfClassInitializationNode -> "Part of class initialization" is PropertyInitializerEnterNode -> "Enter property" is PropertyInitializerExitNode -> "Exit property" + is FieldInitializerEnterNode -> "Enter field" + is FieldInitializerExitNode -> "Exit field" is InitBlockEnterNode -> "Enter init block" is InitBlockExitNode -> "Exit init block" is AnnotationEnterNode -> "Enter annotation" diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/cfg/ControlFlowGraph.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/cfg/ControlFlowGraph.kt index 7d21f20d2de..699fcbefd99 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/cfg/ControlFlowGraph.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/cfg/ControlFlowGraph.kt @@ -80,6 +80,7 @@ class ControlFlowGraph(val declaration: FirDeclaration?, val name: String, val k AnonymousFunction(withBody = true), ClassInitializer(withBody = true), PropertyInitializer(withBody = true), + FieldInitializer(withBody = true), TopLevel(withBody = false), AnnotationCall(withBody = true), DefaultArgument(withBody = false), diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/cfg/ControlFlowGraphBuilder.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/cfg/ControlFlowGraphBuilder.kt index 8bb8403593d..f9b62f6427b 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/cfg/ControlFlowGraphBuilder.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/cfg/ControlFlowGraphBuilder.kt @@ -58,7 +58,7 @@ class ControlFlowGraphBuilder { private val shouldPassFlowFromInplaceLambda: Stack = stackOf(true) private enum class Mode { - Function, TopLevel, Body, ClassInitializer, PropertyInitializer + Function, TopLevel, Body, ClassInitializer, PropertyInitializer, FieldInitializer } // ----------------------------------- Node caches ----------------------------------- @@ -522,6 +522,35 @@ class ControlFlowGraphBuilder { return exitNode to graph } + // ----------------------------------- Field ----------------------------------- + + fun enterField(field: FirField): FieldInitializerEnterNode? { + if (field.initializer == null) return null + + val graph = ControlFlowGraph(field, "val ${field.name}", ControlFlowGraph.Kind.FieldInitializer) + pushGraph(graph, Mode.FieldInitializer) + + val enterNode = createFieldInitializerEnterNode(field) + val exitNode = createFieldInitializerExitNode(field) + exitTargetsForTry.push(exitNode) + + enterToLocalClassesMembers[field.symbol]?.let { + addEdge(it, enterNode, preferredKind = EdgeKind.DfgForward) + } + + lastNodes.push(enterNode) + return enterNode + } + + fun exitField(field: FirField): Pair? { + if (field.initializer == null) return null + val exitNode = exitTargetsForTry.pop() as FieldInitializerExitNode + popAndAddEdge(exitNode) + val graph = popGraph() + assert(exitNode == graph.exitNode) + return exitNode to graph + } + // ----------------------------------- Delegate ----------------------------------- fun enterDelegateExpression() { diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/cfg/ControlFlowGraphNodeBuilder.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/cfg/ControlFlowGraphNodeBuilder.kt index 2d8a69826d3..551984f9e0c 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/cfg/ControlFlowGraphNodeBuilder.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/cfg/ControlFlowGraphNodeBuilder.kt @@ -58,6 +58,12 @@ fun ControlFlowGraphBuilder.createPropertyInitializerExitNode(fir: FirProperty): fun ControlFlowGraphBuilder.createPropertyInitializerEnterNode(fir: FirProperty): PropertyInitializerEnterNode = PropertyInitializerEnterNode(currentGraph, fir, levelCounter, createId()) +fun ControlFlowGraphBuilder.createFieldInitializerExitNode(fir: FirField): FieldInitializerExitNode = + FieldInitializerExitNode(currentGraph, fir, levelCounter, createId()) + +fun ControlFlowGraphBuilder.createFieldInitializerEnterNode(fir: FirField): FieldInitializerEnterNode = + FieldInitializerEnterNode(currentGraph, fir, levelCounter, createId()) + fun ControlFlowGraphBuilder.createFunctionEnterNode(fir: FirFunction<*>): FunctionEnterNode = FunctionEnterNode(currentGraph, fir, levelCounter, createId()).also { currentGraph.enterNode = it diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/cfg/ControlFlowGraphVisitor.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/cfg/ControlFlowGraphVisitor.kt index cb5fc522cc6..a8c9d98eafe 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/cfg/ControlFlowGraphVisitor.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/dfa/cfg/ControlFlowGraphVisitor.kt @@ -80,6 +80,16 @@ abstract class ControlFlowGraphVisitor { return visitNode(node, data) } + // ----------------------------------- Field ----------------------------------- + + open fun visitFieldInitializerEnterNode(node: FieldInitializerEnterNode, data: D): R { + return visitNode(node, data) + } + + open fun visitFieldInitializerExitNode(node: FieldInitializerExitNode, data: D): R { + return visitNode(node, data) + } + // ----------------------------------- Init ----------------------------------- open fun visitInitBlockEnterNode(node: InitBlockEnterNode, data: D): R { diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirTypeResolveTransformer.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirTypeResolveTransformer.kt index 426637818ff..64bbe27c43f 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirTypeResolveTransformer.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirTypeResolveTransformer.kt @@ -19,7 +19,10 @@ import org.jetbrains.kotlin.fir.types.impl.FirImplicitBuiltinTypeRef import org.jetbrains.kotlin.fir.visitors.CompositeTransformResult import org.jetbrains.kotlin.fir.visitors.compose -class FirTypeResolveProcessor(session: FirSession, scopeSession: ScopeSession) : FirTransformerBasedResolveProcessor(session, scopeSession) { +class FirTypeResolveProcessor( + session: FirSession, + scopeSession: ScopeSession +) : FirTransformerBasedResolveProcessor(session, scopeSession) { override val transformer = FirTypeResolveTransformer(session, scopeSession) } @@ -116,6 +119,14 @@ class FirTypeResolveTransformer( } } + override fun transformField(field: FirField, data: Nothing?): CompositeTransformResult { + return withScopeCleanup { + field.replaceResolvePhase(FirResolvePhase.TYPES) + field.transformReturnTypeRef(this, data).transformAnnotations(this, data) + field.compose() + } + } + override fun transformSimpleFunction(simpleFunction: FirSimpleFunction, data: Nothing?): CompositeTransformResult { return withScopeCleanup { simpleFunction.addTypeParametersScope() diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirBodyResolveTransformer.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirBodyResolveTransformer.kt index d127e062ea9..976f182f23c 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirBodyResolveTransformer.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirBodyResolveTransformer.kt @@ -259,6 +259,10 @@ open class FirBodyResolveTransformer( return declarationsTransformer.transformProperty(property, data) } + override fun transformField(field: FirField, data: ResolutionMode): CompositeTransformResult { + return declarationsTransformer.transformField(field, data) + } + override fun transformRegularClass(regularClass: FirRegularClass, data: ResolutionMode): CompositeTransformResult { return declarationsTransformer.transformRegularClass(regularClass, data) } diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirDeclarationsResolveTransformer.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirDeclarationsResolveTransformer.kt index 826950c76fc..93905dbcd98 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirDeclarationsResolveTransformer.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirDeclarationsResolveTransformer.kt @@ -160,6 +160,36 @@ open class FirDeclarationsResolveTransformer(transformer: FirBodyResolveTransfor } } + override fun transformField(field: FirField, data: ResolutionMode): CompositeTransformResult { + val returnTypeRef = field.returnTypeRef + if (implicitTypeOnly) return field.compose() + if (field.resolvePhase == transformerPhase) return field.compose() + if (field.resolvePhase == FirResolvePhase.IMPLICIT_TYPES_BODY_RESOLVE && transformerPhase == FirResolvePhase.BODY_RESOLVE) { + transformer.replaceDeclarationResolvePhaseIfNeeded(field, transformerPhase) + return field.compose() + } + dataFlowAnalyzer.enterField(field) + return withFullBodyResolve { + withLocalScopeCleanup { + val primaryConstructorParametersScope = context.getPrimaryConstructorAllParametersScope() + context.withTowerDataContext(context.getTowerDataContextForConstructorResolution()) { + context.withContainer(field) { + withLocalScopeCleanup { + addLocalScope(primaryConstructorParametersScope) + field.transformChildren(transformer, withExpectedType(returnTypeRef)) + } + if (field.initializer != null) { + storeVariableReturnType(field) + } + } + } + transformer.replaceDeclarationResolvePhaseIfNeeded(field, transformerPhase) + dataFlowAnalyzer.exitField(field) + field.compose() + } + } + } + private fun FirFunctionCall.replacePropertyReferenceTypeInDelegateAccessors(property: FirProperty) { // var someProperty: SomeType // get() = delegate.getValue(thisRef, kProperty: KProperty0/1/2<..., SomeType>) diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/contracts/FirContractResolveTransformer.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/contracts/FirContractResolveTransformer.kt index 8d459fcd262..695041b861d 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/contracts/FirContractResolveTransformer.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/contracts/FirContractResolveTransformer.kt @@ -102,6 +102,11 @@ open class FirContractResolveTransformer( return property.compose() } + override fun transformField(field: FirField, data: ResolutionMode): CompositeTransformResult { + field.updatePhase() + return field.compose() + } + private fun transformPropertyAccessor( propertyAccessor: FirPropertyAccessor, owner: FirProperty diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirClassDeclaredMemberScope.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirClassDeclaredMemberScope.kt index 9d85dfc5f7d..c5ee12605ad 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirClassDeclaredMemberScope.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/scopes/impl/FirClassDeclaredMemberScope.kt @@ -34,7 +34,7 @@ class FirClassDeclaredMemberScope( is FirCallableMemberDeclaration<*> -> { val name = when (declaration) { is FirConstructor -> CONSTRUCTOR_NAME - is FirVariable<*> -> declaration.name + is FirVariable<*> -> if (declaration.isSynthetic) continue@loop else declaration.name is FirSimpleFunction -> declaration.name else -> continue@loop } diff --git a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/builder/FirFieldBuilder.kt b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/builder/FirFieldBuilder.kt index eeec5befdb9..a4e41f30d4e 100644 --- a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/builder/FirFieldBuilder.kt +++ b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/builder/FirFieldBuilder.kt @@ -43,6 +43,7 @@ open class FirFieldBuilder : FirAnnotationContainerBuilder { open lateinit var returnTypeRef: FirTypeRef open lateinit var name: Name open lateinit var symbol: FirVariableSymbol + open var initializer: FirExpression? = null open var isVar: Boolean by kotlin.properties.Delegates.notNull() override val annotations: MutableList = mutableListOf() open val typeParameters: MutableList = mutableListOf() @@ -60,6 +61,7 @@ open class FirFieldBuilder : FirAnnotationContainerBuilder { returnTypeRef, name, symbol, + initializer, isVar, annotations, typeParameters, diff --git a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/impl/FirFieldImpl.kt b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/impl/FirFieldImpl.kt index 2ce4ce50aa6..532753588ff 100644 --- a/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/impl/FirFieldImpl.kt +++ b/compiler/fir/tree/gen/org/jetbrains/kotlin/fir/declarations/impl/FirFieldImpl.kt @@ -38,6 +38,7 @@ internal class FirFieldImpl( override var returnTypeRef: FirTypeRef, override val name: Name, override val symbol: FirVariableSymbol, + override var initializer: FirExpression?, override val isVar: Boolean, override val annotations: MutableList, override val typeParameters: MutableList, @@ -46,7 +47,6 @@ internal class FirFieldImpl( override val dispatchReceiverType: ConeKotlinType?, ) : FirField() { override val receiverTypeRef: FirTypeRef? get() = null - override val initializer: FirExpression? get() = null override val delegate: FirExpression? get() = null override val delegateFieldSymbol: FirDelegateFieldSymbol? get() = null override val isVal: Boolean get() = !isVar @@ -60,6 +60,7 @@ internal class FirFieldImpl( override fun acceptChildren(visitor: FirVisitor, data: D) { returnTypeRef.accept(visitor, data) + initializer?.accept(visitor, data) annotations.forEach { it.accept(visitor, data) } typeParameters.forEach { it.accept(visitor, data) } status.accept(visitor, data) @@ -67,6 +68,7 @@ internal class FirFieldImpl( override fun transformChildren(transformer: FirTransformer, data: D): FirFieldImpl { transformReturnTypeRef(transformer, data) + transformInitializer(transformer, data) transformTypeParameters(transformer, data) transformStatus(transformer, data) transformOtherChildren(transformer, data) @@ -83,6 +85,7 @@ internal class FirFieldImpl( } override fun transformInitializer(transformer: FirTransformer, data: D): FirFieldImpl { + initializer = initializer?.transformSingle(transformer, data) return this } @@ -128,5 +131,7 @@ internal class FirFieldImpl( override fun replaceReceiverTypeRef(newReceiverTypeRef: FirTypeRef?) {} - override fun replaceInitializer(newInitializer: FirExpression?) {} + override fun replaceInitializer(newInitializer: FirExpression?) { + initializer = newInitializer + } } diff --git a/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/ImplementationConfigurator.kt b/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/ImplementationConfigurator.kt index c51fe91e63c..c705a4ce8af 100644 --- a/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/ImplementationConfigurator.kt +++ b/compiler/fir/tree/tree-generator/src/org/jetbrains/kotlin/fir/tree/generator/ImplementationConfigurator.kt @@ -210,7 +210,7 @@ object ImplementationConfigurator : AbstractFirTreeImplementationConfigurator() withGetter = true } - defaultNull("delegateFieldSymbol", "receiverTypeRef", "initializer", "delegate", "getter", "setter", withGetter = true) + defaultNull("delegateFieldSymbol", "receiverTypeRef", "delegate", "getter", "setter", withGetter = true) } impl(enumEntry) { diff --git a/compiler/testData/codegen/box/fir/Fir2IrClassifierStorage.kt b/compiler/testData/codegen/box/fir/Fir2IrClassifierStorage.kt new file mode 100644 index 00000000000..9eae51c0c5c --- /dev/null +++ b/compiler/testData/codegen/box/fir/Fir2IrClassifierStorage.kt @@ -0,0 +1,28 @@ +// TARGET_BACKEND: JVM + +class FirSession(val name: String) + +interface Fir2IrComponents { + val session: FirSession + val classifierStorage: Fir2IrClassifierStorage +} + +class Fir2IrComponentsStorage( + override val session: FirSession +) : Fir2IrComponents { + override lateinit var classifierStorage: Fir2IrClassifierStorage +} + +class Fir2IrClassifierStorage( + private val components: Fir2IrComponents +) : Fir2IrComponents by components { + private val name = session.name +} + +fun box(): String { + val session = FirSession("OK") + val components = Fir2IrComponentsStorage(session) + val classifierStorage = Fir2IrClassifierStorage(components) + components.classifierStorage = classifierStorage + return classifierStorage.session.name +} diff --git a/compiler/testData/ir/irText/classes/delegatedGenericImplementation.fir.kt.txt b/compiler/testData/ir/irText/classes/delegatedGenericImplementation.fir.kt.txt index 4861e83dbf8..73650a6c7c9 100644 --- a/compiler/testData/ir/irText/classes/delegatedGenericImplementation.fir.kt.txt +++ b/compiler/testData/ir/irText/classes/delegatedGenericImplementation.fir.kt.txt @@ -14,7 +14,6 @@ class Test1 : IBase { super/*Any*/() /* () */ - .#<$$delegate_0> = i } override fun foo(a: E, b: B) { @@ -34,7 +33,7 @@ class Test1 : IBase { (.#<$$delegate_0>, ).( = ) } - local /* final field */ val <$$delegate_0>: IBase + local /* final field */ val <$$delegate_0>: IBase = i } @@ -43,14 +42,8 @@ class Test2 : IBase { super/*Any*/() /* () */ - .#<$$delegate_0> = j } - var j: IBase - field = j - get - set - override fun foo(a: String, b: B) { .#<$$delegate_0>.foo(a = a, b = b) } @@ -68,7 +61,11 @@ class Test2 : IBase { (.#<$$delegate_0>, ).( = ) } - local /* final field */ val <$$delegate_0>: IBase + local /* final field */ val <$$delegate_0>: IBase = j + var j: IBase + field = j + get + set } diff --git a/compiler/testData/ir/irText/classes/delegatedGenericImplementation.fir.txt b/compiler/testData/ir/irText/classes/delegatedGenericImplementation.fir.txt index ccdc5eb4067..0cb00f8c810 100644 --- a/compiler/testData/ir/irText/classes/delegatedGenericImplementation.fir.txt +++ b/compiler/testData/ir/irText/classes/delegatedGenericImplementation.fir.txt @@ -46,9 +46,6 @@ FILE fqName: fileName:/delegatedGenericImplementation.kt BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Test1 modality:FINAL visibility:public superTypes:[.IBase.Test1>]' - SET_FIELD 'FIELD DELEGATE name:<$$delegate_0> type:.IBase.Test1> visibility:local [final]' type=kotlin.Unit origin=EQ - receiver: GET_VAR ': .Test1.Test1> declared in .Test1' type=.Test1.Test1> origin=null - value: GET_VAR 'i: .IBase.Test1> declared in .Test1.' type=.IBase.Test1> origin=null FUN DELEGATED_MEMBER name:foo visibility:public modality:OPEN ($this:.Test1.Test1>, a:E of .Test1, b:B of .Test1.foo) returnType:kotlin.Unit overridden: public abstract fun foo (a: A of .IBase, b: B of .IBase.foo): kotlin.Unit declared in .IBase @@ -109,6 +106,8 @@ FILE fqName: fileName:/delegatedGenericImplementation.kt $receiver: GET_VAR ': kotlin.collections.List.Test1.> declared in .Test1.' type=kotlin.collections.List.Test1.> origin=null : GET_VAR ': D of .Test1.? declared in .Test1.' type=D of .Test1.? origin=null FIELD DELEGATE name:<$$delegate_0> type:.IBase.Test1> visibility:local [final] + EXPRESSION_BODY + GET_VAR 'i: .IBase.Test1> declared in .Test1.' type=.IBase.Test1> 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 @@ -129,28 +128,6 @@ FILE fqName: fileName:/delegatedGenericImplementation.kt BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Test2 modality:FINAL visibility:public superTypes:[.IBase]' - SET_FIELD 'FIELD DELEGATE name:<$$delegate_0> type:.IBase visibility:local [final]' type=kotlin.Unit origin=EQ - receiver: GET_VAR ': .Test2 declared in .Test2' type=.Test2 origin=null - value: GET_VAR 'j: .IBase declared in .Test2.' type=.IBase origin=null - PROPERTY name:j visibility:public modality:FINAL [var] - FIELD PROPERTY_BACKING_FIELD name:j type:.IBase visibility:private - EXPRESSION_BODY - GET_VAR 'j: .IBase declared in .Test2.' type=.IBase origin=INITIALIZE_PROPERTY_FROM_PARAMETER - FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.Test2) returnType:.IBase - correspondingProperty: PROPERTY name:j visibility:public modality:FINAL [var] - $this: VALUE_PARAMETER name: type:.Test2 - BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun (): .IBase declared in .Test2' - GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:j type:.IBase visibility:private' type=.IBase origin=null - receiver: GET_VAR ': .Test2 declared in .Test2.' type=.Test2 origin=null - FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.Test2, :.IBase) returnType:kotlin.Unit - correspondingProperty: PROPERTY name:j visibility:public modality:FINAL [var] - $this: VALUE_PARAMETER name: type:.Test2 - VALUE_PARAMETER name: index:0 type:.IBase - BLOCK_BODY - SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:j type:.IBase visibility:private' type=kotlin.Unit origin=null - receiver: GET_VAR ': .Test2 declared in .Test2.' type=.Test2 origin=null - value: GET_VAR ': .IBase declared in .Test2.' type=.IBase origin=null FUN DELEGATED_MEMBER name:foo visibility:public modality:OPEN ($this:.Test2, a:kotlin.String, b:B of .Test2.foo) returnType:kotlin.Unit overridden: public abstract fun foo (a: A of .IBase, b: B of .IBase.foo): kotlin.Unit declared in .IBase @@ -211,6 +188,27 @@ FILE fqName: fileName:/delegatedGenericImplementation.kt $receiver: GET_VAR ': kotlin.collections.List.Test2.> declared in .Test2.' type=kotlin.collections.List.Test2.> origin=null : GET_VAR ': D of .Test2.? declared in .Test2.' type=D of .Test2.? origin=null FIELD DELEGATE name:<$$delegate_0> type:.IBase visibility:local [final] + EXPRESSION_BODY + GET_VAR 'j: .IBase declared in .Test2.' type=.IBase origin=null + PROPERTY name:j visibility:public modality:FINAL [var] + FIELD PROPERTY_BACKING_FIELD name:j type:.IBase visibility:private + EXPRESSION_BODY + GET_VAR 'j: .IBase declared in .Test2.' type=.IBase origin=INITIALIZE_PROPERTY_FROM_PARAMETER + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.Test2) returnType:.IBase + correspondingProperty: PROPERTY name:j visibility:public modality:FINAL [var] + $this: VALUE_PARAMETER name: type:.Test2 + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (): .IBase declared in .Test2' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:j type:.IBase visibility:private' type=.IBase origin=null + receiver: GET_VAR ': .Test2 declared in .Test2.' type=.Test2 origin=null + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.Test2, :.IBase) returnType:kotlin.Unit + correspondingProperty: PROPERTY name:j visibility:public modality:FINAL [var] + $this: VALUE_PARAMETER name: type:.Test2 + VALUE_PARAMETER name: index:0 type:.IBase + BLOCK_BODY + SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:j type:.IBase visibility:private' type=kotlin.Unit origin=null + receiver: GET_VAR ': .Test2 declared in .Test2.' type=.Test2 origin=null + value: GET_VAR ': .IBase declared in .Test2.' type=.IBase 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 diff --git a/compiler/testData/ir/irText/classes/delegatedImplementation.fir.kt.txt b/compiler/testData/ir/irText/classes/delegatedImplementation.fir.kt.txt index 7d3062bf224..32d05a7406b 100644 --- a/compiler/testData/ir/irText/classes/delegatedImplementation.fir.kt.txt +++ b/compiler/testData/ir/irText/classes/delegatedImplementation.fir.kt.txt @@ -82,7 +82,6 @@ class Test1 : IBase { super/*Any*/() /* () */ - .#<$$delegate_0> = BaseImpl } override fun foo(x: Int, s: String) { @@ -97,7 +96,7 @@ class Test1 : IBase { (.#<$$delegate_0>, ).qux() } - local /* final field */ val <$$delegate_0>: IBase + local /* final field */ val <$$delegate_0>: IBase = BaseImpl } @@ -106,8 +105,6 @@ class Test2 : IBase, IOther { super/*Any*/() /* () */ - .#<$$delegate_0> = BaseImpl - .#<$$delegate_1> = otherImpl(x0 = "", y0 = 42) } override fun foo(x: Int, s: String) { @@ -122,7 +119,7 @@ class Test2 : IBase, IOther { (.#<$$delegate_0>, ).qux() } - local /* final field */ val <$$delegate_0>: IBase + local /* final field */ val <$$delegate_0>: IBase = BaseImpl override val x: String override get(): String { return .#<$$delegate_1>.() @@ -149,7 +146,7 @@ class Test2 : IBase, IOther { (.#<$$delegate_1>, ).( = ) } - local /* final field */ val <$$delegate_1>: IOther + local /* final field */ val <$$delegate_1>: IOther = otherImpl(x0 = "", y0 = 42) } diff --git a/compiler/testData/ir/irText/classes/delegatedImplementation.fir.txt b/compiler/testData/ir/irText/classes/delegatedImplementation.fir.txt index cdb02665cd0..747f419f513 100644 --- a/compiler/testData/ir/irText/classes/delegatedImplementation.fir.txt +++ b/compiler/testData/ir/irText/classes/delegatedImplementation.fir.txt @@ -200,9 +200,6 @@ FILE fqName: fileName:/delegatedImplementation.kt BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Test1 modality:FINAL visibility:public superTypes:[.IBase]' - SET_FIELD 'FIELD DELEGATE name:<$$delegate_0> type:.IBase visibility:local [final]' type=kotlin.Unit origin=EQ - receiver: GET_VAR ': .Test1 declared in .Test1' type=.Test1 origin=null - value: GET_OBJECT 'CLASS OBJECT name:BaseImpl modality:FINAL visibility:public superTypes:[.IBase]' type=.BaseImpl FUN DELEGATED_MEMBER name:foo visibility:public modality:OPEN <> ($this:.Test1, x:kotlin.Int, s:kotlin.String) returnType:kotlin.Unit overridden: public abstract fun foo (x: kotlin.Int, s: kotlin.String): kotlin.Unit declared in .IBase @@ -235,6 +232,8 @@ FILE fqName: fileName:/delegatedImplementation.kt 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 FIELD DELEGATE name:<$$delegate_0> type:.IBase visibility:local [final] + EXPRESSION_BODY + GET_OBJECT 'CLASS OBJECT name:BaseImpl modality:FINAL visibility:public superTypes:[.IBase]' type=.BaseImpl 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 @@ -254,14 +253,6 @@ FILE fqName: fileName:/delegatedImplementation.kt BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Test2 modality:FINAL visibility:public superTypes:[.IBase; .IOther]' - SET_FIELD 'FIELD DELEGATE name:<$$delegate_0> type:.IBase visibility:local [final]' type=kotlin.Unit origin=EQ - receiver: GET_VAR ': .Test2 declared in .Test2' type=.Test2 origin=null - value: GET_OBJECT 'CLASS OBJECT name:BaseImpl modality:FINAL visibility:public superTypes:[.IBase]' type=.BaseImpl - SET_FIELD 'FIELD DELEGATE name:<$$delegate_1> type:.IOther visibility:local [final]' type=kotlin.Unit origin=EQ - receiver: GET_VAR ': .Test2 declared in .Test2' type=.Test2 origin=null - value: CALL 'public final fun otherImpl (x0: kotlin.String, y0: kotlin.Int): .IOther declared in ' type=.IOther origin=null - x0: CONST String type=kotlin.String value="" - y0: CONST Int type=kotlin.Int value=42 FUN DELEGATED_MEMBER name:foo visibility:public modality:OPEN <> ($this:.Test2, x:kotlin.Int, s:kotlin.String) returnType:kotlin.Unit overridden: public abstract fun foo (x: kotlin.Int, s: kotlin.String): kotlin.Unit declared in .IBase @@ -294,6 +285,8 @@ FILE fqName: fileName:/delegatedImplementation.kt 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 FIELD DELEGATE name:<$$delegate_0> type:.IBase visibility:local [final] + EXPRESSION_BODY + GET_OBJECT 'CLASS OBJECT name:BaseImpl modality:FINAL visibility:public superTypes:[.IBase]' type=.BaseImpl PROPERTY DELEGATED_MEMBER name:x visibility:public modality:OPEN [val] FUN DELEGATED_MEMBER name: visibility:public modality:OPEN <> ($this:.Test2) returnType:kotlin.String correspondingProperty: PROPERTY DELEGATED_MEMBER name:x visibility:public modality:OPEN [val] @@ -367,6 +360,10 @@ FILE fqName: fileName:/delegatedImplementation.kt $receiver: GET_VAR ': kotlin.Byte declared in .Test2.' type=kotlin.Byte origin=null : GET_VAR ': kotlin.Int declared in .Test2.' type=kotlin.Int origin=null FIELD DELEGATE name:<$$delegate_1> type:.IOther visibility:local [final] + EXPRESSION_BODY + CALL 'public final fun otherImpl (x0: kotlin.String, y0: kotlin.Int): .IOther declared in ' type=.IOther origin=null + x0: CONST String type=kotlin.String value="" + y0: CONST Int type=kotlin.Int value=42 FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] overridden: public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any diff --git a/compiler/testData/ir/irText/classes/delegatedImplementationOfJavaInterface.fir.kt.txt b/compiler/testData/ir/irText/classes/delegatedImplementationOfJavaInterface.fir.kt.txt index f8ae385e192..fb36d5785c8 100644 --- a/compiler/testData/ir/irText/classes/delegatedImplementationOfJavaInterface.fir.kt.txt +++ b/compiler/testData/ir/irText/classes/delegatedImplementationOfJavaInterface.fir.kt.txt @@ -3,13 +3,8 @@ class Test : J { super/*Any*/() /* () */ - .#<$$delegate_0> = j } - private val j: J - field = j - private get - override fun takeNotNull(x: @EnhancedNullability String) { .#<$$delegate_0>.takeNotNull(x = x) } @@ -36,7 +31,10 @@ class Test : J { return .#<$$delegate_0>.returnsFlexible() } - local /* final field */ val <$$delegate_0>: J + local /* final field */ val <$$delegate_0>: J = j + private val j: J + field = j + private get } diff --git a/compiler/testData/ir/irText/classes/delegatedImplementationOfJavaInterface.fir.txt b/compiler/testData/ir/irText/classes/delegatedImplementationOfJavaInterface.fir.txt index 49e7a896708..5cd15a79d17 100644 --- a/compiler/testData/ir/irText/classes/delegatedImplementationOfJavaInterface.fir.txt +++ b/compiler/testData/ir/irText/classes/delegatedImplementationOfJavaInterface.fir.txt @@ -6,20 +6,6 @@ FILE fqName: fileName:/delegatedImplementationOfJavaInterface.kt BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Test modality:FINAL visibility:public superTypes:[.J]' - SET_FIELD 'FIELD DELEGATE name:<$$delegate_0> type:.J visibility:local [final]' type=kotlin.Unit origin=EQ - receiver: GET_VAR ': .Test declared in .Test' type=.Test origin=null - value: GET_VAR 'j: .J declared in .Test.' type=.J origin=null - PROPERTY name:j visibility:private modality:FINAL [val] - FIELD PROPERTY_BACKING_FIELD name:j type:.J visibility:private [final] - EXPRESSION_BODY - GET_VAR 'j: .J declared in .Test.' type=.J origin=INITIALIZE_PROPERTY_FROM_PARAMETER - FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:private modality:FINAL <> ($this:.Test) returnType:.J - correspondingProperty: PROPERTY name:j visibility:private modality:FINAL [val] - $this: VALUE_PARAMETER name: type:.Test - BLOCK_BODY - RETURN type=kotlin.Nothing from='private final fun (): .J declared in .Test' - GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:j type:.J visibility:private [final]' type=.J origin=null - receiver: GET_VAR ': .Test declared in .Test.' type=.Test origin=null FUN DELEGATED_MEMBER name:takeNotNull visibility:public modality:OPEN <> ($this:.Test, x:@[EnhancedNullability] kotlin.String) returnType:kotlin.Unit overridden: public abstract fun takeNotNull (x: @[EnhancedNullability] kotlin.String): kotlin.Unit declared in .J @@ -82,6 +68,19 @@ FILE fqName: fileName:/delegatedImplementationOfJavaInterface.kt $this: GET_FIELD 'FIELD DELEGATE name:<$$delegate_0> type:.J visibility:local [final]' type=.J origin=null receiver: GET_VAR ': .Test declared in .Test.returnsFlexible' type=.Test origin=null FIELD DELEGATE name:<$$delegate_0> type:.J visibility:local [final] + EXPRESSION_BODY + GET_VAR 'j: .J declared in .Test.' type=.J origin=null + PROPERTY name:j visibility:private modality:FINAL [val] + FIELD PROPERTY_BACKING_FIELD name:j type:.J visibility:private [final] + EXPRESSION_BODY + GET_VAR 'j: .J declared in .Test.' type=.J origin=INITIALIZE_PROPERTY_FROM_PARAMETER + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:private modality:FINAL <> ($this:.Test) returnType:.J + correspondingProperty: PROPERTY name:j visibility:private modality:FINAL [val] + $this: VALUE_PARAMETER name: type:.Test + BLOCK_BODY + RETURN type=kotlin.Nothing from='private final fun (): .J declared in .Test' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:j type:.J visibility:private [final]' type=.J origin=null + receiver: GET_VAR ': .Test declared in .Test.' type=.Test 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 diff --git a/compiler/testData/ir/irText/classes/delegatedImplementationWithExplicitOverride.fir.kt.txt b/compiler/testData/ir/irText/classes/delegatedImplementationWithExplicitOverride.fir.kt.txt index 103c62d6993..0c91c731dfd 100644 --- a/compiler/testData/ir/irText/classes/delegatedImplementationWithExplicitOverride.fir.kt.txt +++ b/compiler/testData/ir/irText/classes/delegatedImplementationWithExplicitOverride.fir.kt.txt @@ -24,17 +24,15 @@ class C : IFooBar { super/*Any*/() /* () */ - .#<$$delegate_0> = FooBarImpl - } - - override fun bar() { } override fun foo() { .#<$$delegate_0>.foo() } - local /* final field */ val <$$delegate_0>: IFooBar + local /* final field */ val <$$delegate_0>: IFooBar = FooBarImpl + override fun bar() { + } } diff --git a/compiler/testData/ir/irText/classes/delegatedImplementationWithExplicitOverride.fir.txt b/compiler/testData/ir/irText/classes/delegatedImplementationWithExplicitOverride.fir.txt index a30487d58ad..96935a1c251 100644 --- a/compiler/testData/ir/irText/classes/delegatedImplementationWithExplicitOverride.fir.txt +++ b/compiler/testData/ir/irText/classes/delegatedImplementationWithExplicitOverride.fir.txt @@ -53,14 +53,6 @@ FILE fqName: fileName:/delegatedImplementationWithExplicitOverride.kt BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:C modality:FINAL visibility:public superTypes:[.IFooBar]' - SET_FIELD 'FIELD DELEGATE name:<$$delegate_0> type:.IFooBar visibility:local [final]' type=kotlin.Unit origin=EQ - receiver: GET_VAR ': .C declared in .C' type=.C origin=null - value: GET_OBJECT 'CLASS OBJECT name:FooBarImpl modality:FINAL visibility:public superTypes:[.IFooBar]' type=.FooBarImpl - FUN name:bar visibility:public modality:FINAL <> ($this:.C) returnType:kotlin.Unit - overridden: - public abstract fun bar (): kotlin.Unit declared in .IFooBar - $this: VALUE_PARAMETER name: type:.C - BLOCK_BODY FUN DELEGATED_MEMBER name:foo visibility:public modality:OPEN <> ($this:.C) returnType:kotlin.Unit overridden: public abstract fun foo (): kotlin.Unit declared in .IFooBar @@ -70,6 +62,13 @@ FILE fqName: fileName:/delegatedImplementationWithExplicitOverride.kt $this: GET_FIELD 'FIELD DELEGATE name:<$$delegate_0> type:.IFooBar visibility:local [final]' type=.IFooBar origin=null receiver: GET_VAR ': .C declared in .C.foo' type=.C origin=null FIELD DELEGATE name:<$$delegate_0> type:.IFooBar visibility:local [final] + EXPRESSION_BODY + GET_OBJECT 'CLASS OBJECT name:FooBarImpl modality:FINAL visibility:public superTypes:[.IFooBar]' type=.FooBarImpl + FUN name:bar visibility:public modality:FINAL <> ($this:.C) returnType:kotlin.Unit + overridden: + public abstract fun bar (): kotlin.Unit declared in .IFooBar + $this: VALUE_PARAMETER name: type:.C + BLOCK_BODY FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] overridden: public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any diff --git a/compiler/testData/ir/irText/classes/implicitNotNullOnDelegatedImplementation.fir.kt.txt b/compiler/testData/ir/irText/classes/implicitNotNullOnDelegatedImplementation.fir.kt.txt index 154bbcaad18..f6da264d0a5 100644 --- a/compiler/testData/ir/irText/classes/implicitNotNullOnDelegatedImplementation.fir.kt.txt +++ b/compiler/testData/ir/irText/classes/implicitNotNullOnDelegatedImplementation.fir.kt.txt @@ -52,14 +52,13 @@ class TestJFoo : IFoo { super/*Any*/() /* () */ - .#<$$delegate_0> = JFoo() } override fun foo(): String { return .#<$$delegate_0>.foo() } - local /* final field */ val <$$delegate_0>: IFoo + local /* final field */ val <$$delegate_0>: IFoo = JFoo() } @@ -68,14 +67,13 @@ class TestK1 : IFoo { super/*Any*/() /* () */ - .#<$$delegate_0> = K1() } override fun foo(): String { return .#<$$delegate_0>.foo() } - local /* final field */ val <$$delegate_0>: IFoo + local /* final field */ val <$$delegate_0>: IFoo = K1() } @@ -84,14 +82,13 @@ class TestK2 : IFoo { super/*Any*/() /* () */ - .#<$$delegate_0> = K2() } override fun foo(): String { return .#<$$delegate_0>.foo() } - local /* final field */ val <$$delegate_0>: IFoo + local /* final field */ val <$$delegate_0>: IFoo = K2() } @@ -100,14 +97,13 @@ class TestK3 : IFoo { super/*Any*/() /* () */ - .#<$$delegate_0> = K3() } override fun foo(): String { return .#<$$delegate_0>.foo() } - local /* final field */ val <$$delegate_0>: IFoo + local /* final field */ val <$$delegate_0>: IFoo = K3() } @@ -116,14 +112,13 @@ class TestK4 : IFoo { super/*Any*/() /* () */ - .#<$$delegate_0> = K4() } override fun foo(): String { return .#<$$delegate_0>.foo() } - local /* final field */ val <$$delegate_0>: IFoo + local /* final field */ val <$$delegate_0>: IFoo = K4() } diff --git a/compiler/testData/ir/irText/classes/implicitNotNullOnDelegatedImplementation.fir.txt b/compiler/testData/ir/irText/classes/implicitNotNullOnDelegatedImplementation.fir.txt index cca274e6190..da87507f689 100644 --- a/compiler/testData/ir/irText/classes/implicitNotNullOnDelegatedImplementation.fir.txt +++ b/compiler/testData/ir/irText/classes/implicitNotNullOnDelegatedImplementation.fir.txt @@ -124,9 +124,6 @@ FILE fqName: fileName:/implicitNotNullOnDelegatedImplementation.kt BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:TestJFoo modality:FINAL visibility:public superTypes:[.IFoo]' - SET_FIELD 'FIELD DELEGATE name:<$$delegate_0> type:.IFoo visibility:local [final]' type=kotlin.Unit origin=EQ - receiver: GET_VAR ': .TestJFoo declared in .TestJFoo' type=.TestJFoo origin=null - value: CONSTRUCTOR_CALL 'public constructor () [primary] declared in .JFoo' type=.JFoo origin=null FUN DELEGATED_MEMBER name:foo visibility:public modality:OPEN <> ($this:.TestJFoo) returnType:kotlin.String overridden: public abstract fun foo (): kotlin.String declared in .IFoo @@ -137,6 +134,8 @@ FILE fqName: fileName:/implicitNotNullOnDelegatedImplementation.kt $this: GET_FIELD 'FIELD DELEGATE name:<$$delegate_0> type:.IFoo visibility:local [final]' type=.IFoo origin=null receiver: GET_VAR ': .TestJFoo declared in .TestJFoo.foo' type=.TestJFoo origin=null FIELD DELEGATE name:<$$delegate_0> type:.IFoo visibility:local [final] + EXPRESSION_BODY + CONSTRUCTOR_CALL 'public constructor () [primary] declared in .JFoo' type=.JFoo 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 @@ -156,9 +155,6 @@ FILE fqName: fileName:/implicitNotNullOnDelegatedImplementation.kt BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:TestK1 modality:FINAL visibility:public superTypes:[.IFoo]' - SET_FIELD 'FIELD DELEGATE name:<$$delegate_0> type:.IFoo visibility:local [final]' type=kotlin.Unit origin=EQ - receiver: GET_VAR ': .TestK1 declared in .TestK1' type=.TestK1 origin=null - value: CONSTRUCTOR_CALL 'public constructor () [primary] declared in .K1' type=.K1 origin=null FUN DELEGATED_MEMBER name:foo visibility:public modality:OPEN <> ($this:.TestK1) returnType:kotlin.String overridden: public abstract fun foo (): kotlin.String declared in .IFoo @@ -169,6 +165,8 @@ FILE fqName: fileName:/implicitNotNullOnDelegatedImplementation.kt $this: GET_FIELD 'FIELD DELEGATE name:<$$delegate_0> type:.IFoo visibility:local [final]' type=.IFoo origin=null receiver: GET_VAR ': .TestK1 declared in .TestK1.foo' type=.TestK1 origin=null FIELD DELEGATE name:<$$delegate_0> type:.IFoo visibility:local [final] + EXPRESSION_BODY + CONSTRUCTOR_CALL 'public constructor () [primary] declared in .K1' type=.K1 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 @@ -188,9 +186,6 @@ FILE fqName: fileName:/implicitNotNullOnDelegatedImplementation.kt BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:TestK2 modality:FINAL visibility:public superTypes:[.IFoo]' - SET_FIELD 'FIELD DELEGATE name:<$$delegate_0> type:.IFoo visibility:local [final]' type=kotlin.Unit origin=EQ - receiver: GET_VAR ': .TestK2 declared in .TestK2' type=.TestK2 origin=null - value: CONSTRUCTOR_CALL 'public constructor () [primary] declared in .K2' type=.K2 origin=null FUN DELEGATED_MEMBER name:foo visibility:public modality:OPEN <> ($this:.TestK2) returnType:kotlin.String overridden: public abstract fun foo (): kotlin.String declared in .IFoo @@ -201,6 +196,8 @@ FILE fqName: fileName:/implicitNotNullOnDelegatedImplementation.kt $this: GET_FIELD 'FIELD DELEGATE name:<$$delegate_0> type:.IFoo visibility:local [final]' type=.IFoo origin=null receiver: GET_VAR ': .TestK2 declared in .TestK2.foo' type=.TestK2 origin=null FIELD DELEGATE name:<$$delegate_0> type:.IFoo visibility:local [final] + EXPRESSION_BODY + CONSTRUCTOR_CALL 'public constructor () [primary] declared in .K2' type=.K2 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 @@ -220,9 +217,6 @@ FILE fqName: fileName:/implicitNotNullOnDelegatedImplementation.kt BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:TestK3 modality:FINAL visibility:public superTypes:[.IFoo]' - SET_FIELD 'FIELD DELEGATE name:<$$delegate_0> type:.IFoo visibility:local [final]' type=kotlin.Unit origin=EQ - receiver: GET_VAR ': .TestK3 declared in .TestK3' type=.TestK3 origin=null - value: CONSTRUCTOR_CALL 'public constructor () [primary] declared in .K3' type=.K3 origin=null FUN DELEGATED_MEMBER name:foo visibility:public modality:OPEN <> ($this:.TestK3) returnType:kotlin.String overridden: public abstract fun foo (): kotlin.String declared in .IFoo @@ -233,6 +227,8 @@ FILE fqName: fileName:/implicitNotNullOnDelegatedImplementation.kt $this: GET_FIELD 'FIELD DELEGATE name:<$$delegate_0> type:.IFoo visibility:local [final]' type=.IFoo origin=null receiver: GET_VAR ': .TestK3 declared in .TestK3.foo' type=.TestK3 origin=null FIELD DELEGATE name:<$$delegate_0> type:.IFoo visibility:local [final] + EXPRESSION_BODY + CONSTRUCTOR_CALL 'public constructor () [primary] declared in .K3' type=.K3 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 @@ -252,9 +248,6 @@ FILE fqName: fileName:/implicitNotNullOnDelegatedImplementation.kt BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:TestK4 modality:FINAL visibility:public superTypes:[.IFoo]' - SET_FIELD 'FIELD DELEGATE name:<$$delegate_0> type:.IFoo visibility:local [final]' type=kotlin.Unit origin=EQ - receiver: GET_VAR ': .TestK4 declared in .TestK4' type=.TestK4 origin=null - value: CONSTRUCTOR_CALL 'public constructor () [primary] declared in .K4' type=.K4 origin=null FUN DELEGATED_MEMBER name:foo visibility:public modality:OPEN <> ($this:.TestK4) returnType:kotlin.String overridden: public abstract fun foo (): kotlin.String declared in .IFoo @@ -265,6 +258,8 @@ FILE fqName: fileName:/implicitNotNullOnDelegatedImplementation.kt $this: GET_FIELD 'FIELD DELEGATE name:<$$delegate_0> type:.IFoo visibility:local [final]' type=.IFoo origin=null receiver: GET_VAR ': .TestK4 declared in .TestK4.foo' type=.TestK4 origin=null FIELD DELEGATE name:<$$delegate_0> type:.IFoo visibility:local [final] + EXPRESSION_BODY + CONSTRUCTOR_CALL 'public constructor () [primary] declared in .K4' type=.K4 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 diff --git a/compiler/testData/ir/irText/declarations/annotations/annotationsOnDelegatedMembers.fir.kt.txt b/compiler/testData/ir/irText/declarations/annotations/annotationsOnDelegatedMembers.fir.kt.txt index d2fd97a09fd..29030292342 100644 --- a/compiler/testData/ir/irText/declarations/annotations/annotationsOnDelegatedMembers.fir.kt.txt +++ b/compiler/testData/ir/irText/declarations/annotations/annotationsOnDelegatedMembers.fir.kt.txt @@ -24,7 +24,6 @@ class DFoo : IFoo { super/*Any*/() /* () */ - .#<$$delegate_0> = d } @Ann @@ -49,7 +48,7 @@ class DFoo : IFoo { return (.#<$$delegate_0>, ).() } - local /* final field */ val <$$delegate_0>: IFoo + local /* final field */ val <$$delegate_0>: IFoo = d } diff --git a/compiler/testData/ir/irText/declarations/annotations/annotationsOnDelegatedMembers.fir.txt b/compiler/testData/ir/irText/declarations/annotations/annotationsOnDelegatedMembers.fir.txt index 6eae326f169..0fc194a84d1 100644 --- a/compiler/testData/ir/irText/declarations/annotations/annotationsOnDelegatedMembers.fir.txt +++ b/compiler/testData/ir/irText/declarations/annotations/annotationsOnDelegatedMembers.fir.txt @@ -59,9 +59,6 @@ FILE fqName: fileName:/annotationsOnDelegatedMembers.kt BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:DFoo modality:FINAL visibility:public superTypes:[.IFoo]' - SET_FIELD 'FIELD DELEGATE name:<$$delegate_0> type:.IFoo visibility:local [final]' type=kotlin.Unit origin=EQ - receiver: GET_VAR ': .DFoo declared in .DFoo' type=.DFoo origin=null - value: GET_VAR 'd: .IFoo declared in .DFoo.' type=.IFoo origin=null FUN DELEGATED_MEMBER name:testFun visibility:public modality:OPEN <> ($this:.DFoo) returnType:kotlin.Unit annotations: Ann @@ -113,6 +110,8 @@ FILE fqName: fileName:/annotationsOnDelegatedMembers.kt receiver: GET_VAR ': .DFoo declared in .DFoo.' type=.DFoo origin=null $receiver: GET_VAR ': kotlin.String declared in .DFoo.' type=kotlin.String origin=null FIELD DELEGATE name:<$$delegate_0> type:.IFoo visibility:local [final] + EXPRESSION_BODY + GET_VAR 'd: .IFoo declared in .DFoo.' type=.IFoo 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 diff --git a/compiler/testData/ir/irText/declarations/annotations/inheritingDeprecation.fir.kt.txt b/compiler/testData/ir/irText/declarations/annotations/inheritingDeprecation.fir.kt.txt index 2c3ee7d7203..9061db9158a 100644 --- a/compiler/testData/ir/irText/declarations/annotations/inheritingDeprecation.fir.kt.txt +++ b/compiler/testData/ir/irText/declarations/annotations/inheritingDeprecation.fir.kt.txt @@ -18,7 +18,6 @@ class Delegated : IFoo { super/*Any*/() /* () */ - .#<$$delegate_0> = foo } @Deprecated(message = "") @@ -33,7 +32,7 @@ class Delegated : IFoo { return (.#<$$delegate_0>, ).() } - local /* final field */ val <$$delegate_0>: IFoo + local /* final field */ val <$$delegate_0>: IFoo = foo } diff --git a/compiler/testData/ir/irText/declarations/annotations/inheritingDeprecation.fir.txt b/compiler/testData/ir/irText/declarations/annotations/inheritingDeprecation.fir.txt index 64901ed4215..ac03ff1228d 100644 --- a/compiler/testData/ir/irText/declarations/annotations/inheritingDeprecation.fir.txt +++ b/compiler/testData/ir/irText/declarations/annotations/inheritingDeprecation.fir.txt @@ -40,9 +40,6 @@ FILE fqName: fileName:/inheritingDeprecation.kt BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Delegated modality:FINAL visibility:public superTypes:[.IFoo]' - SET_FIELD 'FIELD DELEGATE name:<$$delegate_0> type:.IFoo visibility:local [final]' type=kotlin.Unit origin=EQ - receiver: GET_VAR ': .Delegated declared in .Delegated' type=.Delegated origin=null - value: GET_VAR 'foo: .IFoo declared in .Delegated.' type=.IFoo origin=null PROPERTY DELEGATED_MEMBER name:prop visibility:public modality:OPEN [val] annotations: Deprecated(message = '', replaceWith = , level = ) @@ -72,6 +69,8 @@ FILE fqName: fileName:/inheritingDeprecation.kt receiver: GET_VAR ': .Delegated declared in .Delegated.' type=.Delegated origin=null $receiver: GET_VAR ': kotlin.String declared in .Delegated.' type=kotlin.String origin=null FIELD DELEGATE name:<$$delegate_0> type:.IFoo visibility:local [final] + EXPRESSION_BODY + GET_VAR 'foo: .IFoo declared in .Delegated.' type=.IFoo 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 diff --git a/compiler/testData/ir/irText/declarations/kt35550.fir.kt.txt b/compiler/testData/ir/irText/declarations/kt35550.fir.kt.txt index ec35a44d722..90017fc08b0 100644 --- a/compiler/testData/ir/irText/declarations/kt35550.fir.kt.txt +++ b/compiler/testData/ir/irText/declarations/kt35550.fir.kt.txt @@ -11,7 +11,6 @@ class A : I { super/*Any*/() /* () */ - .#<$$delegate_0> = i } override val T.id: T @@ -19,7 +18,7 @@ class A : I { return (.#<$$delegate_0>, ).() } - local /* final field */ val <$$delegate_0>: I + local /* final field */ val <$$delegate_0>: I = i } diff --git a/compiler/testData/ir/irText/declarations/kt35550.fir.txt b/compiler/testData/ir/irText/declarations/kt35550.fir.txt index fca54190d10..d453e82a9ef 100644 --- a/compiler/testData/ir/irText/declarations/kt35550.fir.txt +++ b/compiler/testData/ir/irText/declarations/kt35550.fir.txt @@ -30,9 +30,6 @@ FILE fqName: fileName:/kt35550.kt BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:A modality:FINAL visibility:public superTypes:[.I]' - SET_FIELD 'FIELD DELEGATE name:<$$delegate_0> type:.I visibility:local [final]' type=kotlin.Unit origin=EQ - receiver: GET_VAR ': .A declared in .A' type=.A origin=null - value: GET_VAR 'i: .I declared in .A.' type=.I origin=null PROPERTY DELEGATED_MEMBER name:id visibility:public modality:OPEN [val] FUN DELEGATED_MEMBER name: visibility:public modality:OPEN ($this:.A, $receiver:T of .A.) returnType:T of .A. correspondingProperty: PROPERTY DELEGATED_MEMBER name:id visibility:public modality:OPEN [val] @@ -49,6 +46,8 @@ FILE fqName: fileName:/kt35550.kt receiver: GET_VAR ': .A declared in .A.' type=.A origin=null $receiver: GET_VAR ': T of .A. declared in .A.' type=T of .A. origin=null FIELD DELEGATE name:<$$delegate_0> type:.I visibility:local [final] + EXPRESSION_BODY + GET_VAR 'i: .I declared in .A.' type=.I 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 diff --git a/compiler/testData/ir/irText/declarations/parameters/delegatedMembers.fir.kt.txt b/compiler/testData/ir/irText/declarations/parameters/delegatedMembers.fir.kt.txt index 2ea28d408b8..5a876d4c310 100644 --- a/compiler/testData/ir/irText/declarations/parameters/delegatedMembers.fir.kt.txt +++ b/compiler/testData/ir/irText/declarations/parameters/delegatedMembers.fir.kt.txt @@ -12,7 +12,6 @@ class Test : IBase { super/*Any*/() /* () */ - .#<$$delegate_0> = impl } override fun foo(x: Int) { @@ -28,7 +27,7 @@ class Test : IBase { return .#<$$delegate_0>.() } - local /* final field */ val <$$delegate_0>: IBase + local /* final field */ val <$$delegate_0>: IBase = impl } diff --git a/compiler/testData/ir/irText/declarations/parameters/delegatedMembers.fir.txt b/compiler/testData/ir/irText/declarations/parameters/delegatedMembers.fir.txt index 2e25ff1cdb9..a6077d73000 100644 --- a/compiler/testData/ir/irText/declarations/parameters/delegatedMembers.fir.txt +++ b/compiler/testData/ir/irText/declarations/parameters/delegatedMembers.fir.txt @@ -35,9 +35,6 @@ FILE fqName: fileName:/delegatedMembers.kt BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Test modality:FINAL visibility:public superTypes:[.IBase.Test>]' - SET_FIELD 'FIELD DELEGATE name:<$$delegate_0> type:.IBase.Test> visibility:local [final]' type=kotlin.Unit origin=EQ - receiver: GET_VAR ': .Test.Test> declared in .Test' type=.Test.Test> origin=null - value: GET_VAR 'impl: .IBase.Test> declared in .Test.' type=.IBase.Test> origin=null FUN DELEGATED_MEMBER name:foo visibility:public modality:OPEN <> ($this:.Test.Test>, x:kotlin.Int) returnType:kotlin.Unit overridden: public abstract fun foo (x: kotlin.Int): kotlin.Unit declared in .IBase @@ -74,6 +71,8 @@ FILE fqName: fileName:/delegatedMembers.kt $this: GET_FIELD 'FIELD DELEGATE name:<$$delegate_0> type:.IBase.Test> visibility:local [final]' type=.IBase.Test> origin=null receiver: GET_VAR ': .Test.Test> declared in .Test.' type=.Test.Test> origin=null FIELD DELEGATE name:<$$delegate_0> type:.IBase.Test> visibility:local [final] + EXPRESSION_BODY + GET_VAR 'impl: .IBase.Test> declared in .Test.' type=.IBase.Test> 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 diff --git a/compiler/testData/ir/irText/firProblems/AnnotationLoader.fir.kt.txt b/compiler/testData/ir/irText/firProblems/AnnotationLoader.fir.kt.txt index d5b69b11743..7e96f4877a7 100644 --- a/compiler/testData/ir/irText/firProblems/AnnotationLoader.fir.kt.txt +++ b/compiler/testData/ir/irText/firProblems/AnnotationLoader.fir.kt.txt @@ -56,10 +56,6 @@ class AnnotationLoader { super/*Any*/() /* () */ - .#<$$delegate_0> = visitor - } - - override fun visit() { } override fun visitArray(): Visitor? { @@ -70,7 +66,9 @@ class AnnotationLoader { return .#<$$delegate_0>.visitAnnotation() } - local /* final field */ val <$$delegate_0>: Visitor + local /* final field */ val <$$delegate_0>: Visitor = visitor + override fun visit() { + } } diff --git a/compiler/testData/ir/irText/firProblems/AnnotationLoader.fir.txt b/compiler/testData/ir/irText/firProblems/AnnotationLoader.fir.txt index 4a4e4fe278c..e450d609bc7 100644 --- a/compiler/testData/ir/irText/firProblems/AnnotationLoader.fir.txt +++ b/compiler/testData/ir/irText/firProblems/AnnotationLoader.fir.txt @@ -108,14 +108,6 @@ FILE fqName: fileName:/AnnotationLoader.kt BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name: modality:FINAL visibility:local superTypes:[.Visitor]' - SET_FIELD 'FIELD DELEGATE name:<$$delegate_0> type:.Visitor visibility:local [final]' type=kotlin.Unit origin=EQ - receiver: GET_VAR ': .AnnotationLoader.loadAnnotation..visitAnnotation. declared in .AnnotationLoader.loadAnnotation..visitAnnotation.' type=.AnnotationLoader.loadAnnotation..visitAnnotation. origin=null - value: GET_VAR 'val visitor: .Visitor [val] declared in .AnnotationLoader.loadAnnotation..visitAnnotation' type=.Visitor origin=null - FUN name:visit visibility:public modality:FINAL <> ($this:.AnnotationLoader.loadAnnotation..visitAnnotation.) returnType:kotlin.Unit - overridden: - public abstract fun visit (): kotlin.Unit declared in .Visitor - $this: VALUE_PARAMETER name: type:.AnnotationLoader.loadAnnotation..visitAnnotation. - BLOCK_BODY FUN DELEGATED_MEMBER name:visitArray visibility:public modality:OPEN <> ($this:.AnnotationLoader.loadAnnotation..visitAnnotation.) returnType:.Visitor? overridden: public open fun visitArray (): .Visitor? declared in .Visitor @@ -135,6 +127,13 @@ FILE fqName: fileName:/AnnotationLoader.kt $this: GET_FIELD 'FIELD DELEGATE name:<$$delegate_0> type:.Visitor visibility:local [final]' type=.Visitor origin=null receiver: GET_VAR ': .AnnotationLoader.loadAnnotation..visitAnnotation. declared in .AnnotationLoader.loadAnnotation..visitAnnotation..visitAnnotation' type=.AnnotationLoader.loadAnnotation..visitAnnotation. origin=null FIELD DELEGATE name:<$$delegate_0> type:.Visitor visibility:local [final] + EXPRESSION_BODY + GET_VAR 'val visitor: .Visitor [val] declared in .AnnotationLoader.loadAnnotation..visitAnnotation' type=.Visitor origin=null + FUN name:visit visibility:public modality:FINAL <> ($this:.AnnotationLoader.loadAnnotation..visitAnnotation.) returnType:kotlin.Unit + overridden: + public abstract fun visit (): kotlin.Unit declared in .Visitor + $this: VALUE_PARAMETER name: type:.AnnotationLoader.loadAnnotation..visitAnnotation. + BLOCK_BODY FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] overridden: public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any diff --git a/compiler/testData/ir/irText/firProblems/DelegationAndInheritanceFromJava.fir.kt.txt b/compiler/testData/ir/irText/firProblems/DelegationAndInheritanceFromJava.fir.kt.txt index cf7ebc19190..5ae5a47c206 100644 --- a/compiler/testData/ir/irText/firProblems/DelegationAndInheritanceFromJava.fir.kt.txt +++ b/compiler/testData/ir/irText/firProblems/DelegationAndInheritanceFromJava.fir.kt.txt @@ -3,7 +3,6 @@ class Impl : A, B { super/*Any*/() /* () */ - .#<$$delegate_0> = b } override fun add(element: String?): Boolean { @@ -51,7 +50,7 @@ class Impl : A, B { return .#<$$delegate_0>.() } - local /* final field */ val <$$delegate_0>: B + local /* final field */ val <$$delegate_0>: B = b } diff --git a/compiler/testData/ir/irText/firProblems/DelegationAndInheritanceFromJava.fir.txt b/compiler/testData/ir/irText/firProblems/DelegationAndInheritanceFromJava.fir.txt index 9c8a43fdf46..6d6bb4ab0cc 100644 --- a/compiler/testData/ir/irText/firProblems/DelegationAndInheritanceFromJava.fir.txt +++ b/compiler/testData/ir/irText/firProblems/DelegationAndInheritanceFromJava.fir.txt @@ -6,9 +6,6 @@ FILE fqName: fileName:/DelegationAndInheritanceFromJava.kt BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Impl modality:FINAL visibility:public superTypes:[.Foo.A; .Foo.B]' - SET_FIELD 'FIELD DELEGATE name:<$$delegate_0> type:.Foo.B visibility:local [final]' type=kotlin.Unit origin=EQ - receiver: GET_VAR ': .Impl declared in .Impl' type=.Impl origin=null - value: GET_VAR 'b: .Foo.B declared in .Impl.' type=.Foo.B origin=null FUN DELEGATED_MEMBER name:add visibility:public modality:OPEN <> ($this:.Impl, element:kotlin.String?) returnType:kotlin.Boolean overridden: public abstract fun add (element: E of kotlin.collections.MutableSet): kotlin.Boolean declared in kotlin.collections.MutableSet @@ -124,6 +121,8 @@ FILE fqName: fileName:/DelegationAndInheritanceFromJava.kt $this: GET_FIELD 'FIELD DELEGATE name:<$$delegate_0> type:.Foo.B visibility:local [final]' type=.Foo.B origin=null receiver: GET_VAR ': .Impl declared in .Impl.' type=.Impl origin=null FIELD DELEGATE name:<$$delegate_0> type:.Foo.B visibility:local [final] + EXPRESSION_BODY + GET_VAR 'b: .Foo.B declared in .Impl.' type=.Foo.B 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 diff --git a/compiler/testData/ir/irText/firProblems/Fir2IrClassifierStorage.fir.kt.txt b/compiler/testData/ir/irText/firProblems/Fir2IrClassifierStorage.fir.kt.txt new file mode 100644 index 00000000000..f73b371eb74 --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/Fir2IrClassifierStorage.fir.kt.txt @@ -0,0 +1,66 @@ +class FirSession { + constructor(name: String) /* primary */ { + super/*Any*/() + /* () */ + + } + + val name: String + field = name + get + +} + +interface Fir2IrComponents { + abstract val session: FirSession + abstract get + + abstract val classifierStorage: Fir2IrClassifierStorage + abstract get + +} + +class Fir2IrComponentsStorage : Fir2IrComponents { + constructor(session: FirSession) /* primary */ { + super/*Any*/() + /* () */ + + } + + override val session: FirSession + field = session + override get + + override lateinit var classifierStorage: Fir2IrClassifierStorage + override get + set + +} + +class Fir2IrClassifierStorage : Fir2IrComponents { + constructor(components: Fir2IrComponents) /* primary */ { + super/*Any*/() + /* () */ + + } + + override val session: FirSession + override get(): FirSession { + return .#<$$delegate_0>.() + } + + override val classifierStorage: Fir2IrClassifierStorage + override get(): Fir2IrClassifierStorage { + return .#<$$delegate_0>.() + } + + local /* final field */ val <$$delegate_0>: Fir2IrComponents = components + private val components: Fir2IrComponents + field = components + private get + + private val name: String + field = .().() + private get + +} diff --git a/compiler/testData/ir/irText/firProblems/Fir2IrClassifierStorage.fir.txt b/compiler/testData/ir/irText/firProblems/Fir2IrClassifierStorage.fir.txt new file mode 100644 index 00000000000..6ae4fdc9f10 --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/Fir2IrClassifierStorage.fir.txt @@ -0,0 +1,176 @@ +FILE fqName: fileName:/Fir2IrClassifierStorage.kt + CLASS CLASS name:FirSession modality:FINAL visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.FirSession + CONSTRUCTOR visibility:public <> (name:kotlin.String) returnType:.FirSession [primary] + VALUE_PARAMETER name:name index:0 type:kotlin.String + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:FirSession modality:FINAL visibility:public superTypes:[kotlin.Any]' + PROPERTY name:name visibility:public modality:FINAL [val] + FIELD PROPERTY_BACKING_FIELD name:name type:kotlin.String visibility:private [final] + EXPRESSION_BODY + GET_VAR 'name: kotlin.String declared in .FirSession.' type=kotlin.String origin=INITIALIZE_PROPERTY_FROM_PARAMETER + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.FirSession) returnType:kotlin.String + correspondingProperty: PROPERTY name:name visibility:public modality:FINAL [val] + $this: VALUE_PARAMETER name: type:.FirSession + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (): kotlin.String declared in .FirSession' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:name type:kotlin.String visibility:private [final]' type=kotlin.String origin=null + receiver: GET_VAR ': .FirSession declared in .FirSession.' type=.FirSession 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 INTERFACE name:Fir2IrComponents modality:ABSTRACT visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Fir2IrComponents + PROPERTY name:session visibility:public modality:ABSTRACT [val] + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:ABSTRACT <> ($this:.Fir2IrComponents) returnType:.FirSession + correspondingProperty: PROPERTY name:session visibility:public modality:ABSTRACT [val] + $this: VALUE_PARAMETER name: type:.Fir2IrComponents + PROPERTY name:classifierStorage visibility:public modality:ABSTRACT [val] + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:ABSTRACT <> ($this:.Fir2IrComponents) returnType:.Fir2IrClassifierStorage + correspondingProperty: PROPERTY name:classifierStorage visibility:public modality:ABSTRACT [val] + $this: VALUE_PARAMETER name: type:.Fir2IrComponents + 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:Fir2IrComponentsStorage modality:FINAL visibility:public superTypes:[.Fir2IrComponents] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Fir2IrComponentsStorage + CONSTRUCTOR visibility:public <> (session:.FirSession) returnType:.Fir2IrComponentsStorage [primary] + VALUE_PARAMETER name:session index:0 type:.FirSession + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Fir2IrComponentsStorage modality:FINAL visibility:public superTypes:[.Fir2IrComponents]' + PROPERTY name:session visibility:public modality:FINAL [val] + FIELD PROPERTY_BACKING_FIELD name:session type:.FirSession visibility:private [final] + EXPRESSION_BODY + GET_VAR 'session: .FirSession declared in .Fir2IrComponentsStorage.' type=.FirSession origin=INITIALIZE_PROPERTY_FROM_PARAMETER + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.Fir2IrComponentsStorage) returnType:.FirSession + correspondingProperty: PROPERTY name:session visibility:public modality:FINAL [val] + overridden: + public abstract fun (): .FirSession declared in .Fir2IrComponents + $this: VALUE_PARAMETER name: type:.Fir2IrComponentsStorage + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (): .FirSession declared in .Fir2IrComponentsStorage' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:session type:.FirSession visibility:private [final]' type=.FirSession origin=null + receiver: GET_VAR ': .Fir2IrComponentsStorage declared in .Fir2IrComponentsStorage.' type=.Fir2IrComponentsStorage origin=null + PROPERTY name:classifierStorage visibility:public modality:FINAL [lateinit,var] + FIELD PROPERTY_BACKING_FIELD name:classifierStorage type:.Fir2IrClassifierStorage visibility:public + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.Fir2IrComponentsStorage) returnType:.Fir2IrClassifierStorage + correspondingProperty: PROPERTY name:classifierStorage visibility:public modality:FINAL [lateinit,var] + overridden: + public abstract fun (): .Fir2IrClassifierStorage declared in .Fir2IrComponents + $this: VALUE_PARAMETER name: type:.Fir2IrComponentsStorage + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (): .Fir2IrClassifierStorage declared in .Fir2IrComponentsStorage' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:classifierStorage type:.Fir2IrClassifierStorage visibility:public' type=.Fir2IrClassifierStorage origin=null + receiver: GET_VAR ': .Fir2IrComponentsStorage declared in .Fir2IrComponentsStorage.' type=.Fir2IrComponentsStorage origin=null + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.Fir2IrComponentsStorage, :.Fir2IrClassifierStorage) returnType:kotlin.Unit + correspondingProperty: PROPERTY name:classifierStorage visibility:public modality:FINAL [lateinit,var] + $this: VALUE_PARAMETER name: type:.Fir2IrComponentsStorage + VALUE_PARAMETER name: index:0 type:.Fir2IrClassifierStorage + BLOCK_BODY + SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:classifierStorage type:.Fir2IrClassifierStorage visibility:public' type=kotlin.Unit origin=null + receiver: GET_VAR ': .Fir2IrComponentsStorage declared in .Fir2IrComponentsStorage.' type=.Fir2IrComponentsStorage origin=null + value: GET_VAR ': .Fir2IrClassifierStorage declared in .Fir2IrComponentsStorage.' type=.Fir2IrClassifierStorage 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:Fir2IrClassifierStorage modality:FINAL visibility:public superTypes:[.Fir2IrComponents] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Fir2IrClassifierStorage + CONSTRUCTOR visibility:public <> (components:.Fir2IrComponents) returnType:.Fir2IrClassifierStorage [primary] + VALUE_PARAMETER name:components index:0 type:.Fir2IrComponents + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Fir2IrClassifierStorage modality:FINAL visibility:public superTypes:[.Fir2IrComponents]' + PROPERTY DELEGATED_MEMBER name:session visibility:public modality:OPEN [val] + FUN DELEGATED_MEMBER name: visibility:public modality:OPEN <> ($this:.Fir2IrClassifierStorage) returnType:.FirSession + correspondingProperty: PROPERTY DELEGATED_MEMBER name:session visibility:public modality:OPEN [val] + overridden: + public abstract fun (): .FirSession declared in .Fir2IrComponents + $this: VALUE_PARAMETER name: type:.Fir2IrClassifierStorage + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun (): .FirSession declared in .Fir2IrClassifierStorage' + CALL 'public abstract fun (): .FirSession declared in .Fir2IrComponents' type=.FirSession origin=null + $this: GET_FIELD 'FIELD DELEGATE name:<$$delegate_0> type:.Fir2IrComponents visibility:local [final]' type=.Fir2IrComponents origin=null + receiver: GET_VAR ': .Fir2IrClassifierStorage declared in .Fir2IrClassifierStorage.' type=.Fir2IrClassifierStorage origin=null + PROPERTY DELEGATED_MEMBER name:classifierStorage visibility:public modality:OPEN [val] + FUN DELEGATED_MEMBER name: visibility:public modality:OPEN <> ($this:.Fir2IrClassifierStorage) returnType:.Fir2IrClassifierStorage + correspondingProperty: PROPERTY DELEGATED_MEMBER name:classifierStorage visibility:public modality:OPEN [val] + overridden: + public abstract fun (): .Fir2IrClassifierStorage declared in .Fir2IrComponents + $this: VALUE_PARAMETER name: type:.Fir2IrClassifierStorage + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun (): .Fir2IrClassifierStorage declared in .Fir2IrClassifierStorage' + CALL 'public abstract fun (): .Fir2IrClassifierStorage declared in .Fir2IrComponents' type=.Fir2IrClassifierStorage origin=null + $this: GET_FIELD 'FIELD DELEGATE name:<$$delegate_0> type:.Fir2IrComponents visibility:local [final]' type=.Fir2IrComponents origin=null + receiver: GET_VAR ': .Fir2IrClassifierStorage declared in .Fir2IrClassifierStorage.' type=.Fir2IrClassifierStorage origin=null + FIELD DELEGATE name:<$$delegate_0> type:.Fir2IrComponents visibility:local [final] + EXPRESSION_BODY + GET_VAR 'components: .Fir2IrComponents declared in .Fir2IrClassifierStorage.' type=.Fir2IrComponents origin=null + PROPERTY name:components visibility:private modality:FINAL [val] + FIELD PROPERTY_BACKING_FIELD name:components type:.Fir2IrComponents visibility:private [final] + EXPRESSION_BODY + GET_VAR 'components: .Fir2IrComponents declared in .Fir2IrClassifierStorage.' type=.Fir2IrComponents origin=INITIALIZE_PROPERTY_FROM_PARAMETER + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:private modality:FINAL <> ($this:.Fir2IrClassifierStorage) returnType:.Fir2IrComponents + correspondingProperty: PROPERTY name:components visibility:private modality:FINAL [val] + $this: VALUE_PARAMETER name: type:.Fir2IrClassifierStorage + BLOCK_BODY + RETURN type=kotlin.Nothing from='private final fun (): .Fir2IrComponents declared in .Fir2IrClassifierStorage' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:components type:.Fir2IrComponents visibility:private [final]' type=.Fir2IrComponents origin=null + receiver: GET_VAR ': .Fir2IrClassifierStorage declared in .Fir2IrClassifierStorage.' type=.Fir2IrClassifierStorage origin=null + PROPERTY name:name visibility:private modality:FINAL [val] + FIELD PROPERTY_BACKING_FIELD name:name type:kotlin.String visibility:private [final] + EXPRESSION_BODY + CALL 'public final fun (): kotlin.String declared in .FirSession' type=kotlin.String origin=GET_PROPERTY + $this: CALL 'public open fun (): .FirSession declared in .Fir2IrClassifierStorage' type=.FirSession origin=GET_PROPERTY + $this: GET_VAR ': .Fir2IrClassifierStorage declared in .Fir2IrClassifierStorage' type=.Fir2IrClassifierStorage origin=null + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:private modality:FINAL <> ($this:.Fir2IrClassifierStorage) returnType:kotlin.String + correspondingProperty: PROPERTY name:name visibility:private modality:FINAL [val] + $this: VALUE_PARAMETER name: type:.Fir2IrClassifierStorage + BLOCK_BODY + RETURN type=kotlin.Nothing from='private final fun (): kotlin.String declared in .Fir2IrClassifierStorage' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:name type:kotlin.String visibility:private [final]' type=kotlin.String origin=null + receiver: GET_VAR ': .Fir2IrClassifierStorage declared in .Fir2IrClassifierStorage.' type=.Fir2IrClassifierStorage 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 diff --git a/compiler/testData/ir/irText/firProblems/Fir2IrClassifierStorage.kt b/compiler/testData/ir/irText/firProblems/Fir2IrClassifierStorage.kt new file mode 100644 index 00000000000..3fb5b303fdd --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/Fir2IrClassifierStorage.kt @@ -0,0 +1,18 @@ +class FirSession(val name: String) + +interface Fir2IrComponents { + val session: FirSession + val classifierStorage: Fir2IrClassifierStorage +} + +class Fir2IrComponentsStorage( + override val session: FirSession +) : Fir2IrComponents { + override lateinit var classifierStorage: Fir2IrClassifierStorage +} + +class Fir2IrClassifierStorage( + private val components: Fir2IrComponents +) : Fir2IrComponents by components { + private val name = session.name +} diff --git a/compiler/testData/ir/irText/firProblems/Fir2IrClassifierStorage.kt.txt b/compiler/testData/ir/irText/firProblems/Fir2IrClassifierStorage.kt.txt new file mode 100644 index 00000000000..e52d537d945 --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/Fir2IrClassifierStorage.kt.txt @@ -0,0 +1,65 @@ +class FirSession { + constructor(name: String) /* primary */ { + super/*Any*/() + /* () */ + + } + + val name: String + field = name + get + +} + +interface Fir2IrComponents { + abstract val session: FirSession + abstract get + + abstract val classifierStorage: Fir2IrClassifierStorage + abstract get + +} + +class Fir2IrComponentsStorage : Fir2IrComponents { + constructor(session: FirSession) /* primary */ { + super/*Any*/() + /* () */ + + } + + override val session: FirSession + field = session + override get + + override lateinit var classifierStorage: Fir2IrClassifierStorage + override get + open set + +} + +class Fir2IrClassifierStorage : Fir2IrComponents { + constructor(components: Fir2IrComponents) /* primary */ { + super/*Any*/() + /* () */ + + } + + private val components: Fir2IrComponents + field = components + private get + + override val classifierStorage: Fir2IrClassifierStorage + override get(): Fir2IrClassifierStorage { + return .#components.() + } + + override val session: FirSession + override get(): FirSession { + return .#components.() + } + + private val name: String + field = .().() + private get + +} diff --git a/compiler/testData/ir/irText/firProblems/Fir2IrClassifierStorage.txt b/compiler/testData/ir/irText/firProblems/Fir2IrClassifierStorage.txt new file mode 100644 index 00000000000..f33e0eb64c7 --- /dev/null +++ b/compiler/testData/ir/irText/firProblems/Fir2IrClassifierStorage.txt @@ -0,0 +1,173 @@ +FILE fqName: fileName:/Fir2IrClassifierStorage.kt + CLASS CLASS name:FirSession modality:FINAL visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.FirSession + CONSTRUCTOR visibility:public <> (name:kotlin.String) returnType:.FirSession [primary] + VALUE_PARAMETER name:name index:0 type:kotlin.String + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:FirSession modality:FINAL visibility:public superTypes:[kotlin.Any]' + PROPERTY name:name visibility:public modality:FINAL [val] + FIELD PROPERTY_BACKING_FIELD name:name type:kotlin.String visibility:private [final] + EXPRESSION_BODY + GET_VAR 'name: kotlin.String declared in .FirSession.' type=kotlin.String origin=INITIALIZE_PROPERTY_FROM_PARAMETER + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.FirSession) returnType:kotlin.String + correspondingProperty: PROPERTY name:name visibility:public modality:FINAL [val] + $this: VALUE_PARAMETER name: type:.FirSession + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (): kotlin.String declared in .FirSession' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:name type:kotlin.String visibility:private [final]' type=kotlin.String origin=null + receiver: GET_VAR ': .FirSession declared in .FirSession.' type=.FirSession 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 INTERFACE name:Fir2IrComponents modality:ABSTRACT visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Fir2IrComponents + PROPERTY name:session visibility:public modality:ABSTRACT [val] + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:ABSTRACT <> ($this:.Fir2IrComponents) returnType:.FirSession + correspondingProperty: PROPERTY name:session visibility:public modality:ABSTRACT [val] + $this: VALUE_PARAMETER name: type:.Fir2IrComponents + PROPERTY name:classifierStorage visibility:public modality:ABSTRACT [val] + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:ABSTRACT <> ($this:.Fir2IrComponents) returnType:.Fir2IrClassifierStorage + correspondingProperty: PROPERTY name:classifierStorage visibility:public modality:ABSTRACT [val] + $this: VALUE_PARAMETER name: type:.Fir2IrComponents + 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:Fir2IrComponentsStorage modality:FINAL visibility:public superTypes:[.Fir2IrComponents] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Fir2IrComponentsStorage + CONSTRUCTOR visibility:public <> (session:.FirSession) returnType:.Fir2IrComponentsStorage [primary] + VALUE_PARAMETER name:session index:0 type:.FirSession + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Fir2IrComponentsStorage modality:FINAL visibility:public superTypes:[.Fir2IrComponents]' + PROPERTY name:session visibility:public modality:OPEN [val] + FIELD PROPERTY_BACKING_FIELD name:session type:.FirSession visibility:private [final] + EXPRESSION_BODY + GET_VAR 'session: .FirSession declared in .Fir2IrComponentsStorage.' type=.FirSession origin=INITIALIZE_PROPERTY_FROM_PARAMETER + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:OPEN <> ($this:.Fir2IrComponentsStorage) returnType:.FirSession + correspondingProperty: PROPERTY name:session visibility:public modality:OPEN [val] + overridden: + public abstract fun (): .FirSession declared in .Fir2IrComponents + $this: VALUE_PARAMETER name: type:.Fir2IrComponentsStorage + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun (): .FirSession declared in .Fir2IrComponentsStorage' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:session type:.FirSession visibility:private [final]' type=.FirSession origin=null + receiver: GET_VAR ': .Fir2IrComponentsStorage declared in .Fir2IrComponentsStorage.' type=.Fir2IrComponentsStorage origin=null + PROPERTY name:classifierStorage visibility:public modality:OPEN [lateinit,var] + FIELD PROPERTY_BACKING_FIELD name:classifierStorage type:.Fir2IrClassifierStorage visibility:public + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:OPEN <> ($this:.Fir2IrComponentsStorage) returnType:.Fir2IrClassifierStorage + correspondingProperty: PROPERTY name:classifierStorage visibility:public modality:OPEN [lateinit,var] + overridden: + public abstract fun (): .Fir2IrClassifierStorage declared in .Fir2IrComponents + $this: VALUE_PARAMETER name: type:.Fir2IrComponentsStorage + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun (): .Fir2IrClassifierStorage declared in .Fir2IrComponentsStorage' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:classifierStorage type:.Fir2IrClassifierStorage visibility:public' type=.Fir2IrClassifierStorage origin=null + receiver: GET_VAR ': .Fir2IrComponentsStorage declared in .Fir2IrComponentsStorage.' type=.Fir2IrComponentsStorage origin=null + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:OPEN <> ($this:.Fir2IrComponentsStorage, :.Fir2IrClassifierStorage) returnType:kotlin.Unit + correspondingProperty: PROPERTY name:classifierStorage visibility:public modality:OPEN [lateinit,var] + $this: VALUE_PARAMETER name: type:.Fir2IrComponentsStorage + VALUE_PARAMETER name: index:0 type:.Fir2IrClassifierStorage + BLOCK_BODY + SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:classifierStorage type:.Fir2IrClassifierStorage visibility:public' type=kotlin.Unit origin=null + receiver: GET_VAR ': .Fir2IrComponentsStorage declared in .Fir2IrComponentsStorage.' type=.Fir2IrComponentsStorage origin=null + value: GET_VAR ': .Fir2IrClassifierStorage declared in .Fir2IrComponentsStorage.' type=.Fir2IrClassifierStorage 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 .Fir2IrComponents + $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 .Fir2IrComponents + $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 .Fir2IrComponents + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS CLASS name:Fir2IrClassifierStorage modality:FINAL visibility:public superTypes:[.Fir2IrComponents] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Fir2IrClassifierStorage + CONSTRUCTOR visibility:public <> (components:.Fir2IrComponents) returnType:.Fir2IrClassifierStorage [primary] + VALUE_PARAMETER name:components index:0 type:.Fir2IrComponents + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Fir2IrClassifierStorage modality:FINAL visibility:public superTypes:[.Fir2IrComponents]' + PROPERTY name:components visibility:private modality:FINAL [val] + FIELD PROPERTY_BACKING_FIELD name:components type:.Fir2IrComponents visibility:private [final] + EXPRESSION_BODY + GET_VAR 'components: .Fir2IrComponents declared in .Fir2IrClassifierStorage.' type=.Fir2IrComponents origin=INITIALIZE_PROPERTY_FROM_PARAMETER + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:private modality:FINAL <> ($this:.Fir2IrClassifierStorage) returnType:.Fir2IrComponents + correspondingProperty: PROPERTY name:components visibility:private modality:FINAL [val] + $this: VALUE_PARAMETER name: type:.Fir2IrClassifierStorage + BLOCK_BODY + RETURN type=kotlin.Nothing from='private final fun (): .Fir2IrComponents declared in .Fir2IrClassifierStorage' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:components type:.Fir2IrComponents visibility:private [final]' type=.Fir2IrComponents origin=null + receiver: GET_VAR ': .Fir2IrClassifierStorage declared in .Fir2IrClassifierStorage.' type=.Fir2IrClassifierStorage origin=null + PROPERTY DELEGATED_MEMBER name:classifierStorage visibility:public modality:OPEN [val] + FUN DELEGATED_MEMBER name: visibility:public modality:OPEN <> ($this:.Fir2IrClassifierStorage) returnType:.Fir2IrClassifierStorage + correspondingProperty: PROPERTY DELEGATED_MEMBER name:classifierStorage visibility:public modality:OPEN [val] + overridden: + public abstract fun (): .Fir2IrClassifierStorage declared in .Fir2IrComponents + $this: VALUE_PARAMETER name: type:.Fir2IrClassifierStorage + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun (): .Fir2IrClassifierStorage declared in .Fir2IrClassifierStorage' + CALL 'public abstract fun (): .Fir2IrClassifierStorage declared in .Fir2IrComponents' type=.Fir2IrClassifierStorage origin=null + $this: GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:components type:.Fir2IrComponents visibility:private [final]' type=.Fir2IrComponents origin=null + receiver: GET_VAR ': .Fir2IrClassifierStorage declared in .Fir2IrClassifierStorage.' type=.Fir2IrClassifierStorage origin=null + PROPERTY DELEGATED_MEMBER name:session visibility:public modality:OPEN [val] + FUN DELEGATED_MEMBER name: visibility:public modality:OPEN <> ($this:.Fir2IrClassifierStorage) returnType:.FirSession + correspondingProperty: PROPERTY DELEGATED_MEMBER name:session visibility:public modality:OPEN [val] + overridden: + public abstract fun (): .FirSession declared in .Fir2IrComponents + $this: VALUE_PARAMETER name: type:.Fir2IrClassifierStorage + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun (): .FirSession declared in .Fir2IrClassifierStorage' + CALL 'public abstract fun (): .FirSession declared in .Fir2IrComponents' type=.FirSession origin=null + $this: GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:components type:.Fir2IrComponents visibility:private [final]' type=.Fir2IrComponents origin=null + receiver: GET_VAR ': .Fir2IrClassifierStorage declared in .Fir2IrClassifierStorage.' type=.Fir2IrClassifierStorage origin=null + PROPERTY name:name visibility:private modality:FINAL [val] + FIELD PROPERTY_BACKING_FIELD name:name type:kotlin.String visibility:private [final] + EXPRESSION_BODY + CALL 'public final fun (): kotlin.String declared in .FirSession' type=kotlin.String origin=GET_PROPERTY + $this: CALL 'public open fun (): .FirSession declared in .Fir2IrClassifierStorage' type=.FirSession origin=GET_PROPERTY + $this: GET_VAR ': .Fir2IrClassifierStorage declared in .Fir2IrClassifierStorage' type=.Fir2IrClassifierStorage origin=null + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:private modality:FINAL <> ($this:.Fir2IrClassifierStorage) returnType:kotlin.String + correspondingProperty: PROPERTY name:name visibility:private modality:FINAL [val] + $this: VALUE_PARAMETER name: type:.Fir2IrClassifierStorage + BLOCK_BODY + RETURN type=kotlin.Nothing from='private final fun (): kotlin.String declared in .Fir2IrClassifierStorage' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:name type:kotlin.String visibility:private [final]' type=kotlin.String origin=null + receiver: GET_VAR ': .Fir2IrClassifierStorage declared in .Fir2IrClassifierStorage.' type=.Fir2IrClassifierStorage 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 .Fir2IrComponents + $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 .Fir2IrComponents + $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 .Fir2IrComponents + $this: VALUE_PARAMETER name: type:kotlin.Any diff --git a/compiler/testData/ir/irText/firProblems/SignatureClash.fir.kt.txt b/compiler/testData/ir/irText/firProblems/SignatureClash.fir.kt.txt index 885315add8f..c526daa3155 100644 --- a/compiler/testData/ir/irText/firProblems/SignatureClash.fir.kt.txt +++ b/compiler/testData/ir/irText/firProblems/SignatureClash.fir.kt.txt @@ -34,9 +34,13 @@ data class DataClass : Derived, Delegate { super/*Any*/() /* () */ - .#<$$delegate_0> = delegate } + override fun bar() { + .#<$$delegate_0>.bar() + } + + local /* final field */ val <$$delegate_0>: Delegate = delegate val delegate: Delegate field = delegate get @@ -49,11 +53,6 @@ data class DataClass : Derived, Delegate { return DataClass(delegate = delegate) } - override fun bar() { - .#<$$delegate_0>.bar() - } - - local /* final field */ val <$$delegate_0>: Delegate override fun equals(other: Any?): Boolean { when { EQEQEQ(arg0 = , arg1 = other) -> return true diff --git a/compiler/testData/ir/irText/firProblems/SignatureClash.fir.txt b/compiler/testData/ir/irText/firProblems/SignatureClash.fir.txt index eee7eb43a0e..cb1dbac87ff 100644 --- a/compiler/testData/ir/irText/firProblems/SignatureClash.fir.txt +++ b/compiler/testData/ir/irText/firProblems/SignatureClash.fir.txt @@ -90,9 +90,17 @@ FILE fqName: fileName:/SignatureClash.kt BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:DataClass modality:FINAL visibility:public [data] superTypes:[.Derived; .Delegate]' - SET_FIELD 'FIELD DELEGATE name:<$$delegate_0> type:.Delegate visibility:local [final]' type=kotlin.Unit origin=EQ - receiver: GET_VAR ': .DataClass declared in .DataClass' type=.DataClass origin=null - value: GET_VAR 'delegate: .Delegate declared in .DataClass.' type=.Delegate origin=null + FUN DELEGATED_MEMBER name:bar visibility:public modality:OPEN <> ($this:.DataClass) returnType:kotlin.Unit + overridden: + public abstract fun bar (): kotlin.Unit declared in .Delegate + $this: VALUE_PARAMETER name: type:.DataClass + BLOCK_BODY + CALL 'public abstract fun bar (): kotlin.Unit declared in .Delegate' type=kotlin.Unit origin=null + $this: GET_FIELD 'FIELD DELEGATE name:<$$delegate_0> type:.Delegate visibility:local [final]' type=.Delegate origin=null + receiver: GET_VAR ': .DataClass declared in .DataClass.bar' type=.DataClass origin=null + FIELD DELEGATE name:<$$delegate_0> type:.Delegate visibility:local [final] + EXPRESSION_BODY + GET_VAR 'delegate: .Delegate declared in .DataClass.' type=.Delegate origin=null PROPERTY name:delegate visibility:public modality:FINAL [val] FIELD PROPERTY_BACKING_FIELD name:delegate type:.Delegate visibility:private [final] EXPRESSION_BODY @@ -120,15 +128,6 @@ FILE fqName: fileName:/SignatureClash.kt RETURN type=kotlin.Nothing from='public final fun copy (delegate: .Delegate): .DataClass declared in .DataClass' CONSTRUCTOR_CALL 'public constructor (delegate: .Delegate) [primary] declared in .DataClass' type=.DataClass origin=null delegate: GET_VAR 'delegate: .Delegate declared in .DataClass.copy' type=.Delegate origin=null - FUN DELEGATED_MEMBER name:bar visibility:public modality:OPEN <> ($this:.DataClass) returnType:kotlin.Unit - overridden: - public abstract fun bar (): kotlin.Unit declared in .Delegate - $this: VALUE_PARAMETER name: type:.DataClass - BLOCK_BODY - CALL 'public abstract fun bar (): kotlin.Unit declared in .Delegate' type=kotlin.Unit origin=null - $this: GET_FIELD 'FIELD DELEGATE name:<$$delegate_0> type:.Delegate visibility:local [final]' type=.Delegate origin=null - receiver: GET_VAR ': .DataClass declared in .DataClass.bar' type=.DataClass origin=null - FIELD DELEGATE name:<$$delegate_0> type:.Delegate visibility:local [final] FUN GENERATED_DATA_CLASS_MEMBER name:equals visibility:public modality:OPEN <> ($this:.DataClass, other:kotlin.Any?) returnType:kotlin.Boolean overridden: public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any diff --git a/compiler/testData/ir/irText/firProblems/kt43342.fir.kt.txt b/compiler/testData/ir/irText/firProblems/kt43342.fir.kt.txt index c8ff8f1c5f3..c11a33034fd 100644 --- a/compiler/testData/ir/irText/firProblems/kt43342.fir.kt.txt +++ b/compiler/testData/ir/irText/firProblems/kt43342.fir.kt.txt @@ -3,13 +3,8 @@ open class ControlFlowInfo : Map { super/*Any*/() /* () */ - .#<$$delegate_0> = map } - val map: Map - field = map - get - override fun containsKey(key: K): Boolean { return .#<$$delegate_0>.containsKey(key = key) } @@ -52,7 +47,10 @@ open class ControlFlowInfo : Map { return .#<$$delegate_0>.() } - local /* final field */ val <$$delegate_0>: Map + local /* final field */ val <$$delegate_0>: Map = map + val map: Map + field = map + get } diff --git a/compiler/testData/ir/irText/firProblems/kt43342.fir.txt b/compiler/testData/ir/irText/firProblems/kt43342.fir.txt index cdd198c1fb4..a5076e5d6e0 100644 --- a/compiler/testData/ir/irText/firProblems/kt43342.fir.txt +++ b/compiler/testData/ir/irText/firProblems/kt43342.fir.txt @@ -8,20 +8,6 @@ FILE fqName: fileName:/kt43342.kt BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:ControlFlowInfo modality:OPEN visibility:public superTypes:[kotlin.collections.Map.ControlFlowInfo, V of .ControlFlowInfo>]' - SET_FIELD 'FIELD DELEGATE name:<$$delegate_0> type:kotlin.collections.Map.ControlFlowInfo, V of .ControlFlowInfo> visibility:local [final]' type=kotlin.Unit origin=EQ - receiver: GET_VAR ': .ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo> declared in .ControlFlowInfo' type=.ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo> origin=null - value: GET_VAR 'map: kotlin.collections.Map.ControlFlowInfo, V of .ControlFlowInfo> declared in .ControlFlowInfo.' type=kotlin.collections.Map.ControlFlowInfo, V of .ControlFlowInfo> origin=null - PROPERTY name:map visibility:public modality:FINAL [val] - FIELD PROPERTY_BACKING_FIELD name:map type:kotlin.collections.Map.ControlFlowInfo, V of .ControlFlowInfo> visibility:private [final] - EXPRESSION_BODY - GET_VAR 'map: kotlin.collections.Map.ControlFlowInfo, V of .ControlFlowInfo> declared in .ControlFlowInfo.' type=kotlin.collections.Map.ControlFlowInfo, V of .ControlFlowInfo> origin=INITIALIZE_PROPERTY_FROM_PARAMETER - FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo>) returnType:kotlin.collections.Map.ControlFlowInfo, V of .ControlFlowInfo> - correspondingProperty: PROPERTY name:map visibility:public modality:FINAL [val] - $this: VALUE_PARAMETER name: type:.ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo> - BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun (): kotlin.collections.Map.ControlFlowInfo, V of .ControlFlowInfo> declared in .ControlFlowInfo' - GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:map type:kotlin.collections.Map.ControlFlowInfo, V of .ControlFlowInfo> visibility:private [final]' type=kotlin.collections.Map.ControlFlowInfo, V of .ControlFlowInfo> origin=null - receiver: GET_VAR ': .ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo> declared in .ControlFlowInfo.' type=.ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo> origin=null FUN DELEGATED_MEMBER name:containsKey visibility:public modality:OPEN <> ($this:.ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo>, key:K of .ControlFlowInfo) returnType:kotlin.Boolean overridden: public abstract fun containsKey (key: K of kotlin.collections.Map): kotlin.Boolean declared in kotlin.collections.Map @@ -125,6 +111,19 @@ FILE fqName: fileName:/kt43342.kt $this: GET_FIELD 'FIELD DELEGATE name:<$$delegate_0> type:kotlin.collections.Map.ControlFlowInfo, V of .ControlFlowInfo> visibility:local [final]' type=kotlin.collections.Map.ControlFlowInfo, V of .ControlFlowInfo> origin=null receiver: GET_VAR ': .ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo> declared in .ControlFlowInfo.' type=.ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo> origin=null FIELD DELEGATE name:<$$delegate_0> type:kotlin.collections.Map.ControlFlowInfo, V of .ControlFlowInfo> visibility:local [final] + EXPRESSION_BODY + GET_VAR 'map: kotlin.collections.Map.ControlFlowInfo, V of .ControlFlowInfo> declared in .ControlFlowInfo.' type=kotlin.collections.Map.ControlFlowInfo, V of .ControlFlowInfo> origin=null + PROPERTY name:map visibility:public modality:FINAL [val] + FIELD PROPERTY_BACKING_FIELD name:map type:kotlin.collections.Map.ControlFlowInfo, V of .ControlFlowInfo> visibility:private [final] + EXPRESSION_BODY + GET_VAR 'map: kotlin.collections.Map.ControlFlowInfo, V of .ControlFlowInfo> declared in .ControlFlowInfo.' type=kotlin.collections.Map.ControlFlowInfo, V of .ControlFlowInfo> origin=INITIALIZE_PROPERTY_FROM_PARAMETER + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo>) returnType:kotlin.collections.Map.ControlFlowInfo, V of .ControlFlowInfo> + correspondingProperty: PROPERTY name:map visibility:public modality:FINAL [val] + $this: VALUE_PARAMETER name: type:.ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (): kotlin.collections.Map.ControlFlowInfo, V of .ControlFlowInfo> declared in .ControlFlowInfo' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:map type:kotlin.collections.Map.ControlFlowInfo, V of .ControlFlowInfo> visibility:private [final]' type=kotlin.collections.Map.ControlFlowInfo, V of .ControlFlowInfo> origin=null + receiver: GET_VAR ': .ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo> declared in .ControlFlowInfo.' type=.ControlFlowInfo.ControlFlowInfo, V of .ControlFlowInfo> 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 diff --git a/compiler/testData/ir/irText/types/javaWildcardType.fir.kt.txt b/compiler/testData/ir/irText/types/javaWildcardType.fir.kt.txt index f497b74edb0..19c032519a3 100644 --- a/compiler/testData/ir/irText/types/javaWildcardType.fir.kt.txt +++ b/compiler/testData/ir/irText/types/javaWildcardType.fir.kt.txt @@ -11,8 +11,6 @@ class C : J, K { super/*Any*/() /* () */ - .#<$$delegate_0> = j - .#<$$delegate_1> = k } override fun jf1(): Collection? { @@ -31,7 +29,7 @@ class C : J, K { .#<$$delegate_0>.jg2(c = c) } - local /* final field */ val <$$delegate_0>: J + local /* final field */ val <$$delegate_0>: J = j override fun kf1(): Collection { return .#<$$delegate_1>.kf1() } @@ -48,7 +46,7 @@ class C : J, K { .#<$$delegate_1>.kg2(c = c) } - local /* final field */ val <$$delegate_1>: K + local /* final field */ val <$$delegate_1>: K = k } diff --git a/compiler/testData/ir/irText/types/javaWildcardType.fir.txt b/compiler/testData/ir/irText/types/javaWildcardType.fir.txt index 256454833dd..eb3ee656b68 100644 --- a/compiler/testData/ir/irText/types/javaWildcardType.fir.txt +++ b/compiler/testData/ir/irText/types/javaWildcardType.fir.txt @@ -32,12 +32,6 @@ FILE fqName: fileName:/javaWildcardType.kt BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:C modality:FINAL visibility:public superTypes:[.J; .K]' - SET_FIELD 'FIELD DELEGATE name:<$$delegate_0> type:.J visibility:local [final]' type=kotlin.Unit origin=EQ - receiver: GET_VAR ': .C declared in .C' type=.C origin=null - value: GET_VAR 'j: .J declared in .C.' type=.J origin=null - SET_FIELD 'FIELD DELEGATE name:<$$delegate_1> type:.K visibility:local [final]' type=kotlin.Unit origin=EQ - receiver: GET_VAR ': .C declared in .C' type=.C origin=null - value: GET_VAR 'k: .K declared in .C.' type=.K origin=null FUN DELEGATED_MEMBER name:jf1 visibility:public modality:OPEN <> ($this:.C) returnType:kotlin.collections.Collection? overridden: public abstract fun jf1 (): kotlin.collections.Collection? declared in .J @@ -77,6 +71,8 @@ FILE fqName: fileName:/javaWildcardType.kt receiver: GET_VAR ': .C declared in .C.jg2' type=.C origin=null c: GET_VAR 'c: kotlin.collections.Collection? declared in .C.jg2' type=kotlin.collections.Collection? origin=null FIELD DELEGATE name:<$$delegate_0> type:.J visibility:local [final] + EXPRESSION_BODY + GET_VAR 'j: .J declared in .C.' type=.J origin=null FUN DELEGATED_MEMBER name:kf1 visibility:public modality:OPEN <> ($this:.C) returnType:kotlin.collections.Collection overridden: public abstract fun kf1 (): kotlin.collections.Collection declared in .K @@ -116,6 +112,8 @@ FILE fqName: fileName:/javaWildcardType.kt receiver: GET_VAR ': .C declared in .C.kg2' type=.C origin=null c: GET_VAR 'c: kotlin.collections.Collection declared in .C.kg2' type=kotlin.collections.Collection origin=null FIELD DELEGATE name:<$$delegate_1> type:.K visibility:local [final] + EXPRESSION_BODY + GET_VAR 'k: .K declared in .C.' type=.K 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 diff --git a/compiler/testData/ir/irText/types/rawTypeInSignature.fir.kt.txt b/compiler/testData/ir/irText/types/rawTypeInSignature.fir.kt.txt index 0c810163b36..0954b249933 100644 --- a/compiler/testData/ir/irText/types/rawTypeInSignature.fir.kt.txt +++ b/compiler/testData/ir/irText/types/rawTypeInSignature.fir.kt.txt @@ -42,7 +42,6 @@ class KRaw : JRaw { super/*Any*/() /* () */ - .#<$$delegate_0> = j } override fun takesRawList(list: List<*>?) { @@ -77,7 +76,7 @@ class KRaw : JRaw { return .#<$$delegate_0>.returnsRawGenericOut() } - local /* final field */ val <$$delegate_0>: JRaw + local /* final field */ val <$$delegate_0>: JRaw = j } diff --git a/compiler/testData/ir/irText/types/rawTypeInSignature.fir.txt b/compiler/testData/ir/irText/types/rawTypeInSignature.fir.txt index 30b0c189dc0..276e36ae09e 100644 --- a/compiler/testData/ir/irText/types/rawTypeInSignature.fir.txt +++ b/compiler/testData/ir/irText/types/rawTypeInSignature.fir.txt @@ -84,9 +84,6 @@ FILE fqName: fileName:/rawTypeInSignature.kt BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:KRaw modality:FINAL visibility:public superTypes:[.JRaw]' - SET_FIELD 'FIELD DELEGATE name:<$$delegate_0> type:.JRaw visibility:local [final]' type=kotlin.Unit origin=EQ - receiver: GET_VAR ': .KRaw declared in .KRaw' type=.KRaw origin=null - value: GET_VAR 'j: .JRaw declared in .KRaw.' type=.JRaw origin=null FUN DELEGATED_MEMBER name:takesRawList visibility:public modality:OPEN <> ($this:.KRaw, list:kotlin.collections.List<*>?) returnType:kotlin.Unit overridden: public abstract fun takesRawList (list: kotlin.collections.List<*>?): kotlin.Unit declared in .JRaw @@ -164,6 +161,8 @@ FILE fqName: fileName:/rawTypeInSignature.kt $this: GET_FIELD 'FIELD DELEGATE name:<$$delegate_0> type:.JRaw visibility:local [final]' type=.JRaw origin=null receiver: GET_VAR ': .KRaw declared in .KRaw.returnsRawGenericOut' type=.KRaw origin=null FIELD DELEGATE name:<$$delegate_0> type:.JRaw visibility:local [final] + EXPRESSION_BODY + GET_VAR 'j: .JRaw declared in .KRaw.' type=.JRaw 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 diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java index f9d2ebea1ef..87c740b12ff 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java @@ -14840,6 +14840,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/fir/FakeOverrideBuilder.kt"); } + @Test + @TestMetadata("Fir2IrClassifierStorage.kt") + public void testFir2IrClassifierStorage() throws Exception { + runTest("compiler/testData/codegen/box/fir/Fir2IrClassifierStorage.kt"); + } + @Test @TestMetadata("IrBuiltIns.kt") public void testIrBuiltIns() throws Exception { diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java index 42eaa7c9f1c..668138782a5 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java @@ -14840,6 +14840,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/fir/FakeOverrideBuilder.kt"); } + @Test + @TestMetadata("Fir2IrClassifierStorage.kt") + public void testFir2IrClassifierStorage() throws Exception { + runTest("compiler/testData/codegen/box/fir/Fir2IrClassifierStorage.kt"); + } + @Test @TestMetadata("IrBuiltIns.kt") public void testIrBuiltIns() throws Exception { diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/ir/IrTextTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/ir/IrTextTestGenerated.java index 47055458097..b7324e8531e 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/ir/IrTextTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/ir/IrTextTestGenerated.java @@ -2116,6 +2116,12 @@ public class IrTextTestGenerated extends AbstractIrTextTest { runTest("compiler/testData/ir/irText/firProblems/deprecated.kt"); } + @Test + @TestMetadata("Fir2IrClassifierStorage.kt") + public void testFir2IrClassifierStorage() throws Exception { + runTest("compiler/testData/ir/irText/firProblems/Fir2IrClassifierStorage.kt"); + } + @Test @TestMetadata("FirBuilder.kt") public void testFirBuilder() throws Exception { diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index 8b46e23e3fb..0d1479d62d2 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -12273,6 +12273,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/fir/FakeOverrideBuilder.kt"); } + @TestMetadata("Fir2IrClassifierStorage.kt") + public void testFir2IrClassifierStorage() throws Exception { + runTest("compiler/testData/codegen/box/fir/Fir2IrClassifierStorage.kt"); + } + @TestMetadata("IrBuiltIns.kt") public void testIrBuiltIns() throws Exception { runTest("compiler/testData/codegen/box/fir/IrBuiltIns.kt");