From 5af3d92271c66e4fdc996b127e5eac7461b277cf Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Tue, 3 Mar 2020 17:51:18 +0300 Subject: [PATCH] FIR2IR: cache enum entry classes properly --- .../fir/backend/Fir2IrDeclarationStorage.kt | 55 ++++++++----------- .../testData/ir/irText/classes/enum.fir.txt | 22 ++++---- .../irText/classes/enumClassModality.fir.txt | 10 ++-- .../classes/enumWithMultipleCtors.fir.txt | 6 +- .../classes/enumWithSecondaryCtor.fir.txt | 10 ++-- .../enumEntriesWithAnnotations.fir.txt | 4 +- .../expressions/enumEntryAsReceiver.fir.txt | 4 +- ...umEntryReferenceFromEnumEntryClass.fir.txt | 18 +++--- .../temporaryInEnumEntryInitializer.fir.txt | 2 +- .../ir/irText/singletons/enumEntry.fir.txt | 4 +- 10 files changed, 64 insertions(+), 71 deletions(-) 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 b3ad3325a1c..4fa448ad632 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 @@ -8,6 +8,7 @@ package org.jetbrains.kotlin.fir.backend import org.jetbrains.kotlin.descriptors.DeclarationDescriptor import org.jetbrains.kotlin.descriptors.Modality import org.jetbrains.kotlin.descriptors.Visibilities +import org.jetbrains.kotlin.descriptors.Visibility import org.jetbrains.kotlin.fir.FirSession import org.jetbrains.kotlin.fir.declarations.* import org.jetbrains.kotlin.fir.declarations.impl.FirDefaultPropertyGetter @@ -286,44 +287,20 @@ class Fir2IrDeclarationStorage( return getCachedIrClass(klass) ?: createIrClass(klass) } - private fun createIrAnonymousObject(anonymousObject: FirAnonymousObject): IrClass { + private fun createIrAnonymousObject( + anonymousObject: FirAnonymousObject, + visibility: Visibility = Visibilities.LOCAL, + name: Name = Name.special(""), + irParent: IrClass? = null + ): IrClass { val descriptor = WrappedClassDescriptor() val origin = IrDeclarationOrigin.DEFINED val modality = Modality.FINAL - val visibility = Visibilities.LOCAL val result = anonymousObject.convertWithOffsets { startOffset, endOffset -> irSymbolTable.declareClass(startOffset, endOffset, origin, descriptor, modality, visibility) { symbol -> IrClassImpl( startOffset, endOffset, origin, symbol, - Name.special(""), anonymousObject.classKind, - visibility, modality, - isCompanion = false, isInner = false, isData = false, - isExternal = false, isInline = false, isExpect = false, isFun = false - ).apply { - descriptor.bind(this) - setThisReceiver() - } - } - }.declareSupertypesAndTypeParameters(anonymousObject) - localStorage.putLocalClass(anonymousObject, result) - return result - } - - fun getIrAnonymousObject(anonymousObject: FirAnonymousObject): IrClass { - localStorage.getLocalClass(anonymousObject)?.let { return it } - return createIrAnonymousObject(anonymousObject) - } - - private fun getIrEnumEntryClass(enumEntry: FirEnumEntry, anonymousObject: FirAnonymousObject, irParent: IrClass?): IrClass { - val descriptor = WrappedClassDescriptor() - val origin = IrDeclarationOrigin.DEFINED - val modality = Modality.FINAL - val visibility = Visibilities.PRIVATE - return anonymousObject.convertWithOffsets { startOffset, endOffset -> - irSymbolTable.declareClass(startOffset, endOffset, origin, descriptor, modality, visibility) { symbol -> - IrClassImpl( - startOffset, endOffset, origin, symbol, - enumEntry.name, anonymousObject.classKind, + name, anonymousObject.classKind, visibility, modality, isCompanion = false, isInner = false, isData = false, isExternal = false, isInline = false, isExpect = false, isFun = false @@ -336,6 +313,22 @@ class Fir2IrDeclarationStorage( } } }.declareSupertypesAndTypeParameters(anonymousObject) + localStorage.putLocalClass(anonymousObject, result) + return result + } + + fun getIrAnonymousObject( + anonymousObject: FirAnonymousObject, + visibility: Visibility = Visibilities.LOCAL, + name: Name = Name.special(""), + irParent: IrClass? = null + ): IrClass { + localStorage.getLocalClass(anonymousObject)?.let { return it } + return createIrAnonymousObject(anonymousObject, visibility, name, irParent) + } + + private fun getIrEnumEntryClass(enumEntry: FirEnumEntry, anonymousObject: FirAnonymousObject, irParent: IrClass?): IrClass { + return getIrAnonymousObject(anonymousObject, Visibilities.PRIVATE, enumEntry.name, irParent) } private fun getIrTypeParameter( diff --git a/compiler/testData/ir/irText/classes/enum.fir.txt b/compiler/testData/ir/irText/classes/enum.fir.txt index 083c09d00b1..b5e67b7fc02 100644 --- a/compiler/testData/ir/irText/classes/enum.fir.txt +++ b/compiler/testData/ir/irText/classes/enum.fir.txt @@ -75,7 +75,7 @@ FILE fqName: fileName:/enum.kt ENUM_ENTRY name:TEST1 class: CLASS ENUM_ENTRY name:TEST1 modality:FINAL visibility:private superTypes:[.TestEnum2] $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.TestEnum2.TEST1 - CONSTRUCTOR visibility:private <> () returnType:. [primary] + CONSTRUCTOR visibility:private <> () returnType:.TestEnum2.TEST1 [primary] BLOCK_BODY ENUM_CONSTRUCTOR_CALL 'private constructor (x: kotlin.Int) [primary] declared in .TestEnum2' x: CONST Int type=kotlin.Int value=1 @@ -83,7 +83,7 @@ FILE fqName: fileName:/enum.kt ENUM_ENTRY name:TEST2 class: CLASS ENUM_ENTRY name:TEST2 modality:FINAL visibility:private superTypes:[.TestEnum2] $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.TestEnum2.TEST2 - CONSTRUCTOR visibility:private <> () returnType:. [primary] + CONSTRUCTOR visibility:private <> () returnType:.TestEnum2.TEST2 [primary] BLOCK_BODY ENUM_CONSTRUCTOR_CALL 'private constructor (x: kotlin.Int) [primary] declared in .TestEnum2' x: CONST Int type=kotlin.Int value=2 @@ -91,7 +91,7 @@ FILE fqName: fileName:/enum.kt ENUM_ENTRY name:TEST3 class: CLASS ENUM_ENTRY name:TEST3 modality:FINAL visibility:private superTypes:[.TestEnum2] $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.TestEnum2.TEST3 - CONSTRUCTOR visibility:private <> () returnType:. [primary] + CONSTRUCTOR visibility:private <> () returnType:.TestEnum2.TEST3 [primary] BLOCK_BODY ENUM_CONSTRUCTOR_CALL 'private constructor (x: kotlin.Int) [primary] declared in .TestEnum2' x: CONST Int type=kotlin.Int value=3 @@ -147,7 +147,7 @@ FILE fqName: fileName:/enum.kt ENUM_ENTRY name:TEST class: CLASS ENUM_ENTRY name:TEST modality:FINAL visibility:private superTypes:[.TestEnum3] $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.TestEnum3.TEST - CONSTRUCTOR visibility:private <> () returnType:. [primary] + CONSTRUCTOR visibility:private <> () returnType:.TestEnum3.TEST [primary] BLOCK_BODY ENUM_CONSTRUCTOR_CALL 'private constructor () [primary] declared in .TestEnum3' INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_ENTRY name:TEST modality:FINAL visibility:private superTypes:[.TestEnum3]' @@ -221,7 +221,7 @@ FILE fqName: fileName:/enum.kt ENUM_ENTRY name:TEST1 class: CLASS ENUM_ENTRY name:TEST1 modality:FINAL visibility:private superTypes:[.TestEnum4] $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.TestEnum4.TEST1 - CONSTRUCTOR visibility:private <> () returnType:. [primary] + CONSTRUCTOR visibility:private <> () returnType:.TestEnum4.TEST1 [primary] BLOCK_BODY ENUM_CONSTRUCTOR_CALL 'private constructor (x: kotlin.Int) [primary] declared in .TestEnum4' x: CONST Int type=kotlin.Int value=1 @@ -234,7 +234,7 @@ FILE fqName: fileName:/enum.kt ENUM_ENTRY name:TEST2 class: CLASS ENUM_ENTRY name:TEST2 modality:FINAL visibility:private superTypes:[.TestEnum4] $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.TestEnum4.TEST2 - CONSTRUCTOR visibility:private <> () returnType:. [primary] + CONSTRUCTOR visibility:private <> () returnType:.TestEnum4.TEST2 [primary] BLOCK_BODY ENUM_CONSTRUCTOR_CALL 'private constructor (x: kotlin.Int) [primary] declared in .TestEnum4' x: CONST Int type=kotlin.Int value=2 @@ -251,7 +251,7 @@ FILE fqName: fileName:/enum.kt ANONYMOUS_INITIALIZER isStatic=false BLOCK_BODY SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:z type:kotlin.Int visibility:private [final]' type=kotlin.Unit origin=null - receiver: GET_VAR ': . declared in .' type=. origin=null + receiver: GET_VAR ': .TestEnum4.TEST2 declared in .TestEnum4.TEST2' type=.TestEnum4.TEST2 origin=null value: GET_VAR 'x: kotlin.Int declared in .TestEnum4.' type=kotlin.Int origin=null FUN name:foo visibility:public modality:FINAL <> ($this:.TestEnum4.TEST2) returnType:kotlin.Unit $this: VALUE_PARAMETER name: type:.TestEnum4.TEST2 @@ -325,21 +325,21 @@ FILE fqName: fileName:/enum.kt ENUM_ENTRY name:TEST1 class: CLASS ENUM_ENTRY name:TEST1 modality:FINAL visibility:private superTypes:[.TestEnum5] $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.TestEnum5.TEST1 - CONSTRUCTOR visibility:private <> () returnType:. [primary] + CONSTRUCTOR visibility:private <> () returnType:.TestEnum5.TEST1 [primary] BLOCK_BODY ENUM_CONSTRUCTOR_CALL 'private constructor (x: kotlin.Int) [primary] declared in .TestEnum5' INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_ENTRY name:TEST1 modality:FINAL visibility:private superTypes:[.TestEnum5]' ENUM_ENTRY name:TEST2 class: CLASS ENUM_ENTRY name:TEST2 modality:FINAL visibility:private superTypes:[.TestEnum5] $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.TestEnum5.TEST2 - CONSTRUCTOR visibility:private <> () returnType:. [primary] + CONSTRUCTOR visibility:private <> () returnType:.TestEnum5.TEST2 [primary] BLOCK_BODY ENUM_CONSTRUCTOR_CALL 'private constructor (x: kotlin.Int) [primary] declared in .TestEnum5' INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_ENTRY name:TEST2 modality:FINAL visibility:private superTypes:[.TestEnum5]' ENUM_ENTRY name:TEST3 class: CLASS ENUM_ENTRY name:TEST3 modality:FINAL visibility:private superTypes:[.TestEnum5] $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.TestEnum5.TEST3 - CONSTRUCTOR visibility:private <> () returnType:. [primary] + CONSTRUCTOR visibility:private <> () returnType:.TestEnum5.TEST3 [primary] BLOCK_BODY ENUM_CONSTRUCTOR_CALL 'private constructor (x: kotlin.Int) [primary] declared in .TestEnum5' x: CONST Int type=kotlin.Int value=0 @@ -423,7 +423,7 @@ FILE fqName: fileName:/enum.kt ENUM_ENTRY name:TEST class: CLASS ENUM_ENTRY name:TEST modality:FINAL visibility:private superTypes:[.TestEnum6] $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.TestEnum6.TEST - CONSTRUCTOR visibility:private <> () returnType:. [primary] + CONSTRUCTOR visibility:private <> () returnType:.TestEnum6.TEST [primary] BLOCK_BODY ENUM_CONSTRUCTOR_CALL 'private constructor (x: kotlin.Int, y: kotlin.Int) [primary] declared in .TestEnum6' x: CALL 'public final fun f (): kotlin.Int declared in ' type=kotlin.Int origin=null diff --git a/compiler/testData/ir/irText/classes/enumClassModality.fir.txt b/compiler/testData/ir/irText/classes/enumClassModality.fir.txt index dced75f2f73..10189c0d69d 100644 --- a/compiler/testData/ir/irText/classes/enumClassModality.fir.txt +++ b/compiler/testData/ir/irText/classes/enumClassModality.fir.txt @@ -72,7 +72,7 @@ FILE fqName: fileName:/enumClassModality.kt ENUM_ENTRY name:X1 class: CLASS ENUM_ENTRY name:X1 modality:FINAL visibility:private superTypes:[.TestFinalEnum2] $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.TestFinalEnum2.X1 - CONSTRUCTOR visibility:private <> () returnType:. [primary] + CONSTRUCTOR visibility:private <> () returnType:.TestFinalEnum2.X1 [primary] BLOCK_BODY ENUM_CONSTRUCTOR_CALL 'private constructor (x: kotlin.Int) [primary] declared in .TestFinalEnum2' x: CONST Int type=kotlin.Int value=1 @@ -182,7 +182,7 @@ FILE fqName: fileName:/enumClassModality.kt ENUM_ENTRY name:X1 class: CLASS ENUM_ENTRY name:X1 modality:FINAL visibility:private superTypes:[.TestOpenEnum1] $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.TestOpenEnum1.X1 - CONSTRUCTOR visibility:private <> () returnType:. [primary] + CONSTRUCTOR visibility:private <> () returnType:.TestOpenEnum1.X1 [primary] BLOCK_BODY ENUM_CONSTRUCTOR_CALL 'private constructor () [primary] declared in .TestOpenEnum1' INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_ENTRY name:X1 modality:FINAL visibility:private superTypes:[.TestOpenEnum1]' @@ -242,7 +242,7 @@ FILE fqName: fileName:/enumClassModality.kt ENUM_ENTRY name:X1 class: CLASS ENUM_ENTRY name:X1 modality:FINAL visibility:private superTypes:[.TestOpenEnum2] $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.TestOpenEnum2.X1 - CONSTRUCTOR visibility:private <> () returnType:. [primary] + CONSTRUCTOR visibility:private <> () returnType:.TestOpenEnum2.X1 [primary] BLOCK_BODY ENUM_CONSTRUCTOR_CALL 'private constructor () [primary] declared in .TestOpenEnum2' INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_ENTRY name:X1 modality:FINAL visibility:private superTypes:[.TestOpenEnum2]' @@ -303,7 +303,7 @@ FILE fqName: fileName:/enumClassModality.kt ENUM_ENTRY name:X1 class: CLASS ENUM_ENTRY name:X1 modality:FINAL visibility:private superTypes:[.TestAbstractEnum1] $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.TestAbstractEnum1.X1 - CONSTRUCTOR visibility:private <> () returnType:. [primary] + CONSTRUCTOR visibility:private <> () returnType:.TestAbstractEnum1.X1 [primary] BLOCK_BODY ENUM_CONSTRUCTOR_CALL 'private constructor () [primary] declared in .TestAbstractEnum1' INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_ENTRY name:X1 modality:FINAL visibility:private superTypes:[.TestAbstractEnum1]' @@ -380,7 +380,7 @@ FILE fqName: fileName:/enumClassModality.kt ENUM_ENTRY name:X1 class: CLASS ENUM_ENTRY name:X1 modality:FINAL visibility:private superTypes:[.TestAbstractEnum2] $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.TestAbstractEnum2.X1 - CONSTRUCTOR visibility:private <> () returnType:. [primary] + CONSTRUCTOR visibility:private <> () returnType:.TestAbstractEnum2.X1 [primary] BLOCK_BODY ENUM_CONSTRUCTOR_CALL 'private constructor () [primary] declared in .TestAbstractEnum2' INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_ENTRY name:X1 modality:FINAL visibility:private superTypes:[.TestAbstractEnum2]' diff --git a/compiler/testData/ir/irText/classes/enumWithMultipleCtors.fir.txt b/compiler/testData/ir/irText/classes/enumWithMultipleCtors.fir.txt index 7c07ea71272..34649843d47 100644 --- a/compiler/testData/ir/irText/classes/enumWithMultipleCtors.fir.txt +++ b/compiler/testData/ir/irText/classes/enumWithMultipleCtors.fir.txt @@ -4,7 +4,7 @@ FILE fqName: fileName:/enumWithMultipleCtors.kt ENUM_ENTRY name:X class: CLASS ENUM_ENTRY name:X modality:FINAL visibility:private superTypes:[.A] $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.A.X - CONSTRUCTOR visibility:private <> () returnType:. [primary] + CONSTRUCTOR visibility:private <> () returnType:.A.X [primary] BLOCK_BODY ENUM_CONSTRUCTOR_CALL 'private constructor (arg: kotlin.String) declared in .A' arg: CONST String type=kotlin.String value="asd" @@ -12,7 +12,7 @@ FILE fqName: fileName:/enumWithMultipleCtors.kt ENUM_ENTRY name:Y class: CLASS ENUM_ENTRY name:Y modality:FINAL visibility:private superTypes:[.A] $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.A.Y - CONSTRUCTOR visibility:private <> () returnType:. [primary] + CONSTRUCTOR visibility:private <> () returnType:.A.Y [primary] BLOCK_BODY ENUM_CONSTRUCTOR_CALL 'private constructor () declared in .A' INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_ENTRY name:Y modality:FINAL visibility:private superTypes:[.A]' @@ -27,7 +27,7 @@ FILE fqName: fileName:/enumWithMultipleCtors.kt ENUM_ENTRY name:Z class: CLASS ENUM_ENTRY name:Z modality:FINAL visibility:private superTypes:[.A] $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.A.Z - CONSTRUCTOR visibility:private <> () returnType:. [primary] + CONSTRUCTOR visibility:private <> () returnType:.A.Z [primary] BLOCK_BODY ENUM_CONSTRUCTOR_CALL 'private constructor (x: kotlin.Int) declared in .A' x: CONST Int type=kotlin.Int value=5 diff --git a/compiler/testData/ir/irText/classes/enumWithSecondaryCtor.fir.txt b/compiler/testData/ir/irText/classes/enumWithSecondaryCtor.fir.txt index d79e2c7401f..c469e610d21 100644 --- a/compiler/testData/ir/irText/classes/enumWithSecondaryCtor.fir.txt +++ b/compiler/testData/ir/irText/classes/enumWithSecondaryCtor.fir.txt @@ -21,7 +21,7 @@ FILE fqName: fileName:/enumWithSecondaryCtor.kt ENUM_ENTRY name:ZERO class: CLASS ENUM_ENTRY name:ZERO modality:FINAL visibility:private superTypes:[.Test0] $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Test0.ZERO - CONSTRUCTOR visibility:private <> () returnType:. [primary] + CONSTRUCTOR visibility:private <> () returnType:.Test0.ZERO [primary] BLOCK_BODY ENUM_CONSTRUCTOR_CALL 'private constructor () declared in .Test0' INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_ENTRY name:ZERO modality:FINAL visibility:private superTypes:[.Test0]' @@ -92,14 +92,14 @@ FILE fqName: fileName:/enumWithSecondaryCtor.kt ENUM_ENTRY name:ZERO class: CLASS ENUM_ENTRY name:ZERO modality:FINAL visibility:private superTypes:[.Test1] $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Test1.ZERO - CONSTRUCTOR visibility:private <> () returnType:. [primary] + CONSTRUCTOR visibility:private <> () returnType:.Test1.ZERO [primary] BLOCK_BODY ENUM_CONSTRUCTOR_CALL 'private constructor () declared in .Test1' INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_ENTRY name:ZERO modality:FINAL visibility:private superTypes:[.Test1]' ENUM_ENTRY name:ONE class: CLASS ENUM_ENTRY name:ONE modality:FINAL visibility:private superTypes:[.Test1] $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Test1.ONE - CONSTRUCTOR visibility:private <> () returnType:. [primary] + CONSTRUCTOR visibility:private <> () returnType:.Test1.ONE [primary] BLOCK_BODY ENUM_CONSTRUCTOR_CALL 'private constructor (x: kotlin.Int) [primary] declared in .Test1' x: CONST Int type=kotlin.Int value=1 @@ -171,7 +171,7 @@ FILE fqName: fileName:/enumWithSecondaryCtor.kt ENUM_ENTRY name:ZERO class: CLASS ENUM_ENTRY name:ZERO modality:FINAL visibility:private superTypes:[.Test2] $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Test2.ZERO - CONSTRUCTOR visibility:private <> () returnType:. [primary] + CONSTRUCTOR visibility:private <> () returnType:.Test2.ZERO [primary] BLOCK_BODY ENUM_CONSTRUCTOR_CALL 'private constructor () declared in .Test2' INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_ENTRY name:ZERO modality:FINAL visibility:private superTypes:[.Test2]' @@ -183,7 +183,7 @@ FILE fqName: fileName:/enumWithSecondaryCtor.kt ENUM_ENTRY name:ONE class: CLASS ENUM_ENTRY name:ONE modality:FINAL visibility:private superTypes:[.Test2] $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Test2.ONE - CONSTRUCTOR visibility:private <> () returnType:. [primary] + CONSTRUCTOR visibility:private <> () returnType:.Test2.ONE [primary] BLOCK_BODY ENUM_CONSTRUCTOR_CALL 'private constructor (x: kotlin.Int) [primary] declared in .Test2' x: CONST Int type=kotlin.Int value=1 diff --git a/compiler/testData/ir/irText/declarations/annotations/enumEntriesWithAnnotations.fir.txt b/compiler/testData/ir/irText/declarations/annotations/enumEntriesWithAnnotations.fir.txt index 916b26fbe21..e99fe82544e 100644 --- a/compiler/testData/ir/irText/declarations/annotations/enumEntriesWithAnnotations.fir.txt +++ b/compiler/testData/ir/irText/declarations/annotations/enumEntriesWithAnnotations.fir.txt @@ -39,7 +39,7 @@ FILE fqName: fileName:/enumEntriesWithAnnotations.kt annotations: TestAnn(x = 'ENTRY1') $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.TestEnum.ENTRY1 - CONSTRUCTOR visibility:private <> () returnType:. [primary] + CONSTRUCTOR visibility:private <> () returnType:.TestEnum.ENTRY1 [primary] BLOCK_BODY ENUM_CONSTRUCTOR_CALL 'private constructor () [primary] declared in .TestEnum' INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_ENTRY name:ENTRY1 modality:FINAL visibility:private superTypes:[.TestEnum]' @@ -48,7 +48,7 @@ FILE fqName: fileName:/enumEntriesWithAnnotations.kt annotations: TestAnn(x = 'ENTRY2') $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.TestEnum.ENTRY2 - CONSTRUCTOR visibility:private <> () returnType:. [primary] + CONSTRUCTOR visibility:private <> () returnType:.TestEnum.ENTRY2 [primary] BLOCK_BODY ENUM_CONSTRUCTOR_CALL 'private constructor () [primary] declared in .TestEnum' INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_ENTRY name:ENTRY2 modality:FINAL visibility:private superTypes:[.TestEnum]' diff --git a/compiler/testData/ir/irText/expressions/enumEntryAsReceiver.fir.txt b/compiler/testData/ir/irText/expressions/enumEntryAsReceiver.fir.txt index 844e014763a..b4878db22c4 100644 --- a/compiler/testData/ir/irText/expressions/enumEntryAsReceiver.fir.txt +++ b/compiler/testData/ir/irText/expressions/enumEntryAsReceiver.fir.txt @@ -9,7 +9,7 @@ FILE fqName: fileName:/enumEntryAsReceiver.kt ENUM_ENTRY name:B class: CLASS ENUM_ENTRY name:B modality:FINAL visibility:private superTypes:[.X] $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.X.B - CONSTRUCTOR visibility:private <> () returnType:. [primary] + CONSTRUCTOR visibility:private <> () returnType:.X.B [primary] BLOCK_BODY ENUM_CONSTRUCTOR_CALL 'private constructor () [primary] declared in .X' INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_ENTRY name:B modality:FINAL visibility:private superTypes:[.X]' @@ -32,7 +32,7 @@ FILE fqName: fileName:/enumEntryAsReceiver.kt BLOCK_BODY RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .X.B.value' CALL 'public final fun (): kotlin.String declared in .X.B' type=kotlin.String origin=GET_PROPERTY - $this: GET_VAR ': . declared in .' type=. origin=null + $this: GET_VAR ': .X.B declared in .X.B' type=.X.B origin=null FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.X.B) returnType:kotlin.Function0 correspondingProperty: PROPERTY name:value visibility:public modality:FINAL [val] $this: VALUE_PARAMETER name: type:.X.B diff --git a/compiler/testData/ir/irText/expressions/enumEntryReferenceFromEnumEntryClass.fir.txt b/compiler/testData/ir/irText/expressions/enumEntryReferenceFromEnumEntryClass.fir.txt index 55c19bce1d3..2ae61d1bd32 100644 --- a/compiler/testData/ir/irText/expressions/enumEntryReferenceFromEnumEntryClass.fir.txt +++ b/compiler/testData/ir/irText/expressions/enumEntryReferenceFromEnumEntryClass.fir.txt @@ -9,7 +9,7 @@ FILE fqName: fileName:/enumEntryReferenceFromEnumEntryClass.kt ENUM_ENTRY name:Z class: CLASS ENUM_ENTRY name:Z modality:FINAL visibility:private superTypes:[.MyEnum] $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.MyEnum.Z - CONSTRUCTOR visibility:private <> () returnType:. [primary] + CONSTRUCTOR visibility:private <> () returnType:.MyEnum.Z [primary] BLOCK_BODY ENUM_CONSTRUCTOR_CALL 'private constructor () [primary] declared in .MyEnum' INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_ENTRY name:Z modality:FINAL visibility:private superTypes:[.MyEnum]' @@ -39,10 +39,10 @@ FILE fqName: fileName:/enumEntryReferenceFromEnumEntryClass.kt $this: VALUE_PARAMETER name: type:.MyEnum.Z BLOCK_BODY SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:counter type:kotlin.Int visibility:private' type=kotlin.Unit origin=null - receiver: GET_VAR ': . declared in .' type=. origin=null + receiver: GET_VAR ': .MyEnum.Z declared in .MyEnum.Z' type=.MyEnum.Z origin=null value: CONST Int type=kotlin.Int value=1 CALL 'public final fun foo (): kotlin.Unit declared in .MyEnum.Z' type=kotlin.Unit origin=null - $this: GET_VAR ': . declared in .' type=. origin=null + $this: GET_VAR ': .MyEnum.Z declared in .MyEnum.Z' type=.MyEnum.Z origin=null PROPERTY name:aLambda visibility:public modality:FINAL [val] FIELD PROPERTY_BACKING_FIELD name:aLambda type:kotlin.Function0 visibility:private [final] EXPRESSION_BODY @@ -50,10 +50,10 @@ FILE fqName: fileName:/enumEntryReferenceFromEnumEntryClass.kt FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit BLOCK_BODY SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:counter type:kotlin.Int visibility:private' type=kotlin.Unit origin=null - receiver: GET_VAR ': . declared in .' type=. origin=null + receiver: GET_VAR ': .MyEnum.Z declared in .MyEnum.Z' type=.MyEnum.Z origin=null value: CONST Int type=kotlin.Int value=1 CALL 'public final fun foo (): kotlin.Unit declared in .MyEnum.Z' type=kotlin.Unit origin=null - $this: GET_VAR ': . declared in .' type=. origin=null + $this: GET_VAR ': .MyEnum.Z declared in .MyEnum.Z' type=.MyEnum.Z origin=null FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.MyEnum.Z) returnType:kotlin.Function0 correspondingProperty: PROPERTY name:aLambda visibility:public modality:FINAL [val] $this: VALUE_PARAMETER name: type:.MyEnum.Z @@ -74,18 +74,18 @@ FILE fqName: fileName:/enumEntryReferenceFromEnumEntryClass.kt ANONYMOUS_INITIALIZER isStatic=false BLOCK_BODY SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:counter type:kotlin.Int visibility:private' type=kotlin.Unit origin=null - receiver: GET_VAR ': . declared in .' type=. origin=null + receiver: GET_VAR ': .MyEnum.Z declared in .MyEnum.Z' type=.MyEnum.Z origin=null value: CONST Int type=kotlin.Int value=1 CALL 'public final fun foo (): kotlin.Unit declared in .MyEnum.Z' type=kotlin.Unit origin=null - $this: GET_VAR ': . declared in .' type=. origin=null + $this: GET_VAR ': .MyEnum.Z declared in .MyEnum.Z' type=.MyEnum.Z origin=null FUN name:test visibility:public modality:FINAL <> ($this:.MyEnum.Z.anObject.) returnType:kotlin.Unit $this: VALUE_PARAMETER name: type:.MyEnum.Z.anObject. BLOCK_BODY SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:counter type:kotlin.Int visibility:private' type=kotlin.Unit origin=null - receiver: GET_VAR ': . declared in .' type=. origin=null + receiver: GET_VAR ': .MyEnum.Z declared in .MyEnum.Z' type=.MyEnum.Z origin=null value: CONST Int type=kotlin.Int value=1 CALL 'public final fun foo (): kotlin.Unit declared in .MyEnum.Z' type=kotlin.Unit origin=null - $this: GET_VAR ': . declared in .' type=. origin=null + $this: GET_VAR ': .MyEnum.Z declared in .MyEnum.Z' type=.MyEnum.Z origin=null CONSTRUCTOR_CALL 'private constructor () [primary] declared in .MyEnum.Z.anObject.' type=.MyEnum.Z.anObject. origin=null FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.MyEnum.Z) returnType:.MyEnum.Z.anObject. correspondingProperty: PROPERTY name:anObject visibility:public modality:FINAL [val] diff --git a/compiler/testData/ir/irText/expressions/temporaryInEnumEntryInitializer.fir.txt b/compiler/testData/ir/irText/expressions/temporaryInEnumEntryInitializer.fir.txt index ab13237482c..f3f3a7145b5 100644 --- a/compiler/testData/ir/irText/expressions/temporaryInEnumEntryInitializer.fir.txt +++ b/compiler/testData/ir/irText/expressions/temporaryInEnumEntryInitializer.fir.txt @@ -30,7 +30,7 @@ FILE fqName: fileName:/temporaryInEnumEntryInitializer.kt ENUM_ENTRY name:ENTRY class: CLASS ENUM_ENTRY name:ENTRY modality:FINAL visibility:private superTypes:[.En] $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.En.ENTRY - CONSTRUCTOR visibility:private <> () returnType:. [primary] + CONSTRUCTOR visibility:private <> () returnType:.En.ENTRY [primary] BLOCK_BODY ENUM_CONSTRUCTOR_CALL 'private constructor (x: kotlin.String?) [primary] declared in .En' x: CALL 'public open fun toString (): kotlin.String declared in kotlin.Any' type=kotlin.String? origin=null diff --git a/compiler/testData/ir/irText/singletons/enumEntry.fir.txt b/compiler/testData/ir/irText/singletons/enumEntry.fir.txt index c431b74a491..6e0cd205691 100644 --- a/compiler/testData/ir/irText/singletons/enumEntry.fir.txt +++ b/compiler/testData/ir/irText/singletons/enumEntry.fir.txt @@ -9,7 +9,7 @@ FILE fqName: fileName:/enumEntry.kt ENUM_ENTRY name:ENTRY class: CLASS ENUM_ENTRY name:ENTRY modality:FINAL visibility:private superTypes:[.Z] $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Z.ENTRY - CONSTRUCTOR visibility:private <> () returnType:. [primary] + CONSTRUCTOR visibility:private <> () returnType:.Z.ENTRY [primary] BLOCK_BODY ENUM_CONSTRUCTOR_CALL 'private constructor () [primary] declared in .Z' INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_ENTRY name:ENTRY modality:FINAL visibility:private superTypes:[.Z]' @@ -26,7 +26,7 @@ FILE fqName: fileName:/enumEntry.kt $this: VALUE_PARAMETER name: type:.Z.ENTRY.A BLOCK_BODY CALL 'public final fun test (): kotlin.Unit declared in .Z.ENTRY' type=kotlin.Unit origin=null - $this: GET_VAR ': . declared in .' type=. origin=null + $this: GET_VAR ': .Z.ENTRY declared in .Z.ENTRY' type=.Z.ENTRY 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