From f173af9238d6996c534f3d7a2c79ce37d8ec39b8 Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Wed, 19 Feb 2020 12:34:56 +0300 Subject: [PATCH] FIR2IR: use enum constructor call for enum entries --- .../kotlin/fir/backend/Fir2IrVisitor.kt | 21 +++++++++++----- .../kotlin/fir/resolve/calls/ResolverParts.kt | 2 +- .../fir/declarations/FirDeclarationUtil.kt | 2 ++ .../testData/ir/irText/classes/enum.fir.txt | 24 +++++++++---------- .../irText/classes/enumClassModality.fir.txt | 14 +++++------ .../classes/enumWithMultipleCtors.fir.txt | 8 +++---- .../classes/enumWithSecondaryCtor.fir.txt | 16 ++++++------- .../enumEntriesWithAnnotations.fir.txt | 4 ++-- .../enumsInAnnotationArguments.fir.txt | 8 +++---- .../multiplatform/expectedEnumClass.fir.txt | 10 ++++---- .../expressions/enumEntryAsReceiver.fir.txt | 2 +- ...umEntryReferenceFromEnumEntryClass.fir.txt | 2 +- .../expressions/objectAsCallable.fir.txt | 2 +- .../temporaryInEnumEntryInitializer.fir.txt | 2 +- .../ir/irText/expressions/values.fir.txt | 2 +- .../ir/irText/singletons/enumEntry.fir.txt | 2 +- 16 files changed, 66 insertions(+), 55 deletions(-) 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 5a64669d78c..59cedd5024a 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 @@ -404,16 +404,25 @@ class Fir2IrVisitor( } } - private fun FirDelegatedConstructorCall.toIrDelegatingConstructorCall(): IrDelegatingConstructorCall? { + private fun FirDelegatedConstructorCall.toIrDelegatingConstructorCall(): IrCallWithIndexedArgumentsBase? { val constructedIrType = constructedTypeRef.toIrType(this@Fir2IrVisitor.session, declarationStorage) val constructorSymbol = (this.calleeReference as? FirResolvedNamedReference)?.resolvedSymbol as? FirConstructorSymbol ?: return null return convertWithOffsets { startOffset, endOffset -> - IrDelegatingConstructorCallImpl( - startOffset, endOffset, - constructedIrType, - declarationStorage.getIrFunctionSymbol(constructorSymbol) as IrConstructorSymbol - ).apply { + val irConstructorSymbol = declarationStorage.getIrFunctionSymbol(constructorSymbol) as IrConstructorSymbol + if (constructorSymbol.fir.isFromEnumClass) { + IrEnumConstructorCallImpl( + startOffset, endOffset, + constructedIrType, + irConstructorSymbol + ) + } else { + IrDelegatingConstructorCallImpl( + startOffset, endOffset, + constructedIrType, + irConstructorSymbol + ) + }.apply { for ((index, argument) in arguments.withIndex()) { val argumentExpression = argument.toIrExpression() putValueArgument(index, argumentExpression) diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/ResolverParts.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/ResolverParts.kt index 377b56a2492..d7f57710e4e 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/ResolverParts.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/ResolverParts.kt @@ -421,7 +421,7 @@ internal object CheckVisibility : CheckerStage() { } Visibilities.PRIVATE, Visibilities.PRIVATE_TO_THIS -> { if (declaration.session == callInfo.session) { - if (ownerId == null || declaration is FirConstructor && declaration.status.isFromSealedClass) { + if (ownerId == null || declaration is FirConstructor && declaration.isFromSealedClass) { // Top-level: visible in file candidateFile == useSiteFile } else { diff --git a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/declarations/FirDeclarationUtil.kt b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/declarations/FirDeclarationUtil.kt index 4cbbad7d366..7b0a2055173 100644 --- a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/declarations/FirDeclarationUtil.kt +++ b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/declarations/FirDeclarationUtil.kt @@ -39,6 +39,8 @@ inline val FirMemberDeclaration.isExternal: Boolean get() = status.isExternal inline val FirMemberDeclaration.isSuspend: Boolean get() = status.isSuspend inline val FirMemberDeclaration.isConst: Boolean get() = status.isConst inline val FirMemberDeclaration.isLateInit: Boolean get() = status.isLateInit +inline val FirMemberDeclaration.isFromSealedClass: Boolean get() = status.isFromSealedClass +inline val FirMemberDeclaration.isFromEnumClass: Boolean get() = status.isFromEnumClass inline val FirPropertyAccessor.modality get() = status.modality inline val FirPropertyAccessor.visibility get() = status.visibility diff --git a/compiler/testData/ir/irText/classes/enum.fir.txt b/compiler/testData/ir/irText/classes/enum.fir.txt index 3976e5a0fbd..dca78b69b01 100644 --- a/compiler/testData/ir/irText/classes/enum.fir.txt +++ b/compiler/testData/ir/irText/classes/enum.fir.txt @@ -10,14 +10,14 @@ FILE fqName: fileName:/enum.kt $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.TestEnum1.TEST1 CONSTRUCTOR visibility:private <> () returnType:. [primary] BLOCK_BODY - DELEGATING_CONSTRUCTOR_CALL 'private constructor () [primary] declared in .TestEnum1' + ENUM_CONSTRUCTOR_CALL 'private constructor () [primary] declared in .TestEnum1' INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_ENTRY name:TEST1 modality:FINAL visibility:private superTypes:[.TestEnum1]' ENUM_ENTRY name:TEST2 class: CLASS ENUM_ENTRY name:TEST2 modality:FINAL visibility:private superTypes:[.TestEnum1] $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.TestEnum1.TEST2 CONSTRUCTOR visibility:private <> () returnType:. [primary] BLOCK_BODY - DELEGATING_CONSTRUCTOR_CALL 'private constructor () [primary] declared in .TestEnum1' + ENUM_CONSTRUCTOR_CALL 'private constructor () [primary] declared in .TestEnum1' INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_ENTRY name:TEST2 modality:FINAL visibility:private superTypes:[.TestEnum1]' FUN name:values visibility:public modality:FINAL <> ($this:.TestEnum1) returnType:kotlin.Array<.TestEnum1> $this: VALUE_PARAMETER name: type:.TestEnum1 @@ -83,7 +83,7 @@ FILE fqName: fileName:/enum.kt $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.TestEnum2.TEST1 CONSTRUCTOR visibility:private <> () returnType:. [primary] BLOCK_BODY - DELEGATING_CONSTRUCTOR_CALL 'private constructor (x: kotlin.Int) [primary] declared in .TestEnum2' + ENUM_CONSTRUCTOR_CALL 'private constructor (x: kotlin.Int) [primary] declared in .TestEnum2' x: CONST Int type=kotlin.Int value=1 INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_ENTRY name:TEST1 modality:FINAL visibility:private superTypes:[.TestEnum2]' ENUM_ENTRY name:TEST2 @@ -91,7 +91,7 @@ FILE fqName: fileName:/enum.kt $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.TestEnum2.TEST2 CONSTRUCTOR visibility:private <> () returnType:. [primary] BLOCK_BODY - DELEGATING_CONSTRUCTOR_CALL 'private constructor (x: kotlin.Int) [primary] declared in .TestEnum2' + ENUM_CONSTRUCTOR_CALL 'private constructor (x: kotlin.Int) [primary] declared in .TestEnum2' x: CONST Int type=kotlin.Int value=2 INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_ENTRY name:TEST2 modality:FINAL visibility:private superTypes:[.TestEnum2]' ENUM_ENTRY name:TEST3 @@ -99,7 +99,7 @@ FILE fqName: fileName:/enum.kt $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.TestEnum2.TEST3 CONSTRUCTOR visibility:private <> () returnType:. [primary] BLOCK_BODY - DELEGATING_CONSTRUCTOR_CALL 'private constructor (x: kotlin.Int) [primary] declared in .TestEnum2' + ENUM_CONSTRUCTOR_CALL 'private constructor (x: kotlin.Int) [primary] declared in .TestEnum2' x: CONST Int type=kotlin.Int value=3 INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_ENTRY name:TEST3 modality:FINAL visibility:private superTypes:[.TestEnum2]' FUN name:values visibility:public modality:FINAL <> ($this:.TestEnum2) returnType:kotlin.Array<.TestEnum2> @@ -154,7 +154,7 @@ FILE fqName: fileName:/enum.kt $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.TestEnum3.TEST CONSTRUCTOR visibility:private <> () returnType:. [primary] BLOCK_BODY - DELEGATING_CONSTRUCTOR_CALL 'private constructor () [primary] declared in .TestEnum3' + ENUM_CONSTRUCTOR_CALL 'private constructor () [primary] declared in .TestEnum3' INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_ENTRY name:TEST modality:FINAL visibility:private superTypes:[.TestEnum3]' FUN name:foo visibility:public modality:FINAL <> ($this:.TestEnum3.TEST) returnType:kotlin.Unit $this: VALUE_PARAMETER name: type:.TestEnum3.TEST @@ -227,7 +227,7 @@ FILE fqName: fileName:/enum.kt $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.TestEnum4.TEST1 CONSTRUCTOR visibility:private <> () returnType:. [primary] BLOCK_BODY - DELEGATING_CONSTRUCTOR_CALL 'private constructor (x: kotlin.Int) [primary] declared in .TestEnum4' + ENUM_CONSTRUCTOR_CALL 'private constructor (x: kotlin.Int) [primary] declared in .TestEnum4' x: CONST Int type=kotlin.Int value=1 INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_ENTRY name:TEST1 modality:FINAL visibility:private superTypes:[.TestEnum4]' FUN name:foo visibility:public modality:FINAL <> ($this:.TestEnum4.TEST1) returnType:kotlin.Unit @@ -240,7 +240,7 @@ FILE fqName: fileName:/enum.kt $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.TestEnum4.TEST2 CONSTRUCTOR visibility:private <> () returnType:. [primary] BLOCK_BODY - DELEGATING_CONSTRUCTOR_CALL 'private constructor (x: kotlin.Int) [primary] declared in .TestEnum4' + ENUM_CONSTRUCTOR_CALL 'private constructor (x: kotlin.Int) [primary] declared in .TestEnum4' x: CONST Int type=kotlin.Int value=2 INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_ENTRY name:TEST2 modality:FINAL visibility:private superTypes:[.TestEnum4]' PROPERTY name:z visibility:public modality:FINAL [val] @@ -330,21 +330,21 @@ FILE fqName: fileName:/enum.kt $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.TestEnum5.TEST1 CONSTRUCTOR visibility:private <> () returnType:. [primary] BLOCK_BODY - DELEGATING_CONSTRUCTOR_CALL 'private constructor (x: kotlin.Int) [primary] declared in .TestEnum5' + 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] BLOCK_BODY - DELEGATING_CONSTRUCTOR_CALL 'private constructor (x: kotlin.Int) [primary] declared in .TestEnum5' + 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] BLOCK_BODY - DELEGATING_CONSTRUCTOR_CALL 'private constructor (x: kotlin.Int) [primary] declared in .TestEnum5' + ENUM_CONSTRUCTOR_CALL 'private constructor (x: kotlin.Int) [primary] declared in .TestEnum5' x: CONST Int type=kotlin.Int value=0 INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_ENTRY name:TEST3 modality:FINAL visibility:private superTypes:[.TestEnum5]' FUN name:values visibility:public modality:FINAL <> ($this:.TestEnum5) returnType:kotlin.Array<.TestEnum5> @@ -427,7 +427,7 @@ FILE fqName: fileName:/enum.kt $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.TestEnum6.TEST CONSTRUCTOR visibility:private <> () returnType:. [primary] BLOCK_BODY - DELEGATING_CONSTRUCTOR_CALL 'private constructor (x: kotlin.Int, y: kotlin.Int) [primary] declared in .TestEnum6' + 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 y: CALL 'public final fun f (): kotlin.Int declared in ' type=kotlin.Int origin=null INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_ENTRY name:TEST modality:FINAL visibility:private superTypes:[.TestEnum6]' diff --git a/compiler/testData/ir/irText/classes/enumClassModality.fir.txt b/compiler/testData/ir/irText/classes/enumClassModality.fir.txt index dd1f1eace80..f6d8c9ab4d3 100644 --- a/compiler/testData/ir/irText/classes/enumClassModality.fir.txt +++ b/compiler/testData/ir/irText/classes/enumClassModality.fir.txt @@ -10,7 +10,7 @@ FILE fqName: fileName:/enumClassModality.kt $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.TestFinalEnum1.X1 CONSTRUCTOR visibility:private <> () returnType:. [primary] BLOCK_BODY - DELEGATING_CONSTRUCTOR_CALL 'private constructor () [primary] declared in .TestFinalEnum1' + ENUM_CONSTRUCTOR_CALL 'private constructor () [primary] declared in .TestFinalEnum1' INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_ENTRY name:X1 modality:FINAL visibility:private superTypes:[.TestFinalEnum1]' FUN name:values visibility:public modality:FINAL <> ($this:.TestFinalEnum1) returnType:kotlin.Array<.TestFinalEnum1> $this: VALUE_PARAMETER name: type:.TestFinalEnum1 @@ -76,7 +76,7 @@ FILE fqName: fileName:/enumClassModality.kt $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.TestFinalEnum2.X1 CONSTRUCTOR visibility:private <> () returnType:. [primary] BLOCK_BODY - DELEGATING_CONSTRUCTOR_CALL 'private constructor (x: kotlin.Int) [primary] declared in .TestFinalEnum2' + ENUM_CONSTRUCTOR_CALL 'private constructor (x: kotlin.Int) [primary] declared in .TestFinalEnum2' x: CONST Int type=kotlin.Int value=1 INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_ENTRY name:X1 modality:FINAL visibility:private superTypes:[.TestFinalEnum2]' FUN name:values visibility:public modality:FINAL <> ($this:.TestFinalEnum2) returnType:kotlin.Array<.TestFinalEnum2> @@ -131,7 +131,7 @@ FILE fqName: fileName:/enumClassModality.kt $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.TestFinalEnum3.X1 CONSTRUCTOR visibility:private <> () returnType:. [primary] BLOCK_BODY - DELEGATING_CONSTRUCTOR_CALL 'private constructor () [primary] declared in .TestFinalEnum3' + ENUM_CONSTRUCTOR_CALL 'private constructor () [primary] declared in .TestFinalEnum3' INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_ENTRY name:X1 modality:FINAL visibility:private superTypes:[.TestFinalEnum3]' FUN name:doStuff visibility:public modality:FINAL <> ($this:.TestFinalEnum3) returnType:kotlin.Unit $this: VALUE_PARAMETER name: type:.TestFinalEnum3 @@ -188,7 +188,7 @@ FILE fqName: fileName:/enumClassModality.kt $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.TestOpenEnum1.X1 CONSTRUCTOR visibility:private <> () returnType:. [primary] BLOCK_BODY - DELEGATING_CONSTRUCTOR_CALL 'private constructor () [primary] declared in .TestOpenEnum1' + ENUM_CONSTRUCTOR_CALL 'private constructor () [primary] declared in .TestOpenEnum1' INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_ENTRY name:X1 modality:FINAL visibility:private superTypes:[.TestOpenEnum1]' FUN name:toString visibility:public modality:FINAL <> ($this:.TestOpenEnum1.X1) returnType:kotlin.String $this: VALUE_PARAMETER name: type:.TestOpenEnum1.X1 @@ -247,7 +247,7 @@ FILE fqName: fileName:/enumClassModality.kt $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.TestOpenEnum2.X1 CONSTRUCTOR visibility:private <> () returnType:. [primary] BLOCK_BODY - DELEGATING_CONSTRUCTOR_CALL 'private constructor () [primary] declared in .TestOpenEnum2' + ENUM_CONSTRUCTOR_CALL 'private constructor () [primary] declared in .TestOpenEnum2' INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_ENTRY name:X1 modality:FINAL visibility:private superTypes:[.TestOpenEnum2]' FUN name:foo visibility:public modality:FINAL <> ($this:.TestOpenEnum2.X1) returnType:kotlin.Unit $this: VALUE_PARAMETER name: type:.TestOpenEnum2.X1 @@ -307,7 +307,7 @@ FILE fqName: fileName:/enumClassModality.kt $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.TestAbstractEnum1.X1 CONSTRUCTOR visibility:private <> () returnType:. [primary] BLOCK_BODY - DELEGATING_CONSTRUCTOR_CALL 'private constructor () [primary] declared in .TestAbstractEnum1' + ENUM_CONSTRUCTOR_CALL 'private constructor () [primary] declared in .TestAbstractEnum1' INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_ENTRY name:X1 modality:FINAL visibility:private superTypes:[.TestAbstractEnum1]' FUN name:foo visibility:public modality:FINAL <> ($this:.TestAbstractEnum1.X1) returnType:kotlin.Unit $this: VALUE_PARAMETER name: type:.TestAbstractEnum1.X1 @@ -383,7 +383,7 @@ FILE fqName: fileName:/enumClassModality.kt $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.TestAbstractEnum2.X1 CONSTRUCTOR visibility:private <> () returnType:. [primary] BLOCK_BODY - DELEGATING_CONSTRUCTOR_CALL 'private constructor () [primary] declared in .TestAbstractEnum2' + ENUM_CONSTRUCTOR_CALL 'private constructor () [primary] declared in .TestAbstractEnum2' INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_ENTRY name:X1 modality:FINAL visibility:private superTypes:[.TestAbstractEnum2]' FUN name:foo visibility:public modality:FINAL <> ($this:.TestAbstractEnum2.X1) returnType:kotlin.Unit $this: VALUE_PARAMETER name: type:.TestAbstractEnum2.X1 diff --git a/compiler/testData/ir/irText/classes/enumWithMultipleCtors.fir.txt b/compiler/testData/ir/irText/classes/enumWithMultipleCtors.fir.txt index d3fd71f6dac..8f9b6ae48a2 100644 --- a/compiler/testData/ir/irText/classes/enumWithMultipleCtors.fir.txt +++ b/compiler/testData/ir/irText/classes/enumWithMultipleCtors.fir.txt @@ -6,7 +6,7 @@ FILE fqName: fileName:/enumWithMultipleCtors.kt $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.A.X CONSTRUCTOR visibility:private <> () returnType:. [primary] BLOCK_BODY - DELEGATING_CONSTRUCTOR_CALL 'private constructor (arg: kotlin.String) declared in .A' + ENUM_CONSTRUCTOR_CALL 'private constructor (arg: kotlin.String) declared in .A' arg: CONST String type=kotlin.String value="asd" INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_ENTRY name:X modality:FINAL visibility:private superTypes:[.A]' ENUM_ENTRY name:Y @@ -14,7 +14,7 @@ FILE fqName: fileName:/enumWithMultipleCtors.kt $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.A.Y CONSTRUCTOR visibility:private <> () returnType:. [primary] BLOCK_BODY - DELEGATING_CONSTRUCTOR_CALL 'private constructor () declared in .A' + ENUM_CONSTRUCTOR_CALL 'private constructor () declared in .A' INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_ENTRY name:Y modality:FINAL visibility:private superTypes:[.A]' FUN name:f visibility:public modality:FINAL <> ($this:.A.Y) returnType:kotlin.String $this: VALUE_PARAMETER name: type:.A.Y @@ -29,7 +29,7 @@ FILE fqName: fileName:/enumWithMultipleCtors.kt $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.A.Z CONSTRUCTOR visibility:private <> () returnType:. [primary] BLOCK_BODY - DELEGATING_CONSTRUCTOR_CALL 'private constructor (x: kotlin.Int) declared in .A' + ENUM_CONSTRUCTOR_CALL 'private constructor (x: kotlin.Int) declared in .A' x: CONST Int type=kotlin.Int value=5 INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_ENTRY name:Z modality:FINAL visibility:private superTypes:[.A]' PROPERTY name:prop1 visibility:public modality:FINAL [val] @@ -95,7 +95,7 @@ FILE fqName: fileName:/enumWithMultipleCtors.kt SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:prop3 type:kotlin.String visibility:private' type=kotlin.Unit origin=null receiver: GET_VAR ': .A declared in .A' type=.A origin=null value: CONST String type=kotlin.String value="int" - DELEGATING_CONSTRUCTOR_CALL 'private constructor (arg: kotlin.String) declared in .A' + ENUM_CONSTRUCTOR_CALL 'private constructor (arg: kotlin.String) declared in .A' arg: CALL 'public open fun toString (): kotlin.String declared in kotlin.Any' type=kotlin.String origin=null $this: GET_VAR 'x: kotlin.Int declared in .A.' type=kotlin.Int origin=null FUN name:f visibility:public modality:OPEN <> ($this:.A) returnType:kotlin.String diff --git a/compiler/testData/ir/irText/classes/enumWithSecondaryCtor.fir.txt b/compiler/testData/ir/irText/classes/enumWithSecondaryCtor.fir.txt index 7ac601574d8..e40534a2221 100644 --- a/compiler/testData/ir/irText/classes/enumWithSecondaryCtor.fir.txt +++ b/compiler/testData/ir/irText/classes/enumWithSecondaryCtor.fir.txt @@ -22,11 +22,11 @@ FILE fqName: fileName:/enumWithSecondaryCtor.kt $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Test0.ZERO CONSTRUCTOR visibility:private <> () returnType:. [primary] BLOCK_BODY - DELEGATING_CONSTRUCTOR_CALL 'private constructor () declared in .Test0' + ENUM_CONSTRUCTOR_CALL 'private constructor () declared in .Test0' INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_ENTRY name:ZERO modality:FINAL visibility:private superTypes:[.Test0]' CONSTRUCTOR visibility:private <> () returnType:.Test0 BLOCK_BODY - DELEGATING_CONSTRUCTOR_CALL 'private constructor (x: kotlin.Int) [primary] declared in .Test0' + ENUM_CONSTRUCTOR_CALL 'private constructor (x: kotlin.Int) [primary] declared in .Test0' x: CONST Int type=kotlin.Int value=0 FUN name:values visibility:public modality:FINAL <> ($this:.Test0) returnType:kotlin.Array<.Test0> $this: VALUE_PARAMETER name: type:.Test0 @@ -92,19 +92,19 @@ FILE fqName: fileName:/enumWithSecondaryCtor.kt $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Test1.ZERO CONSTRUCTOR visibility:private <> () returnType:. [primary] BLOCK_BODY - DELEGATING_CONSTRUCTOR_CALL 'private constructor () declared in .Test1' + 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] BLOCK_BODY - DELEGATING_CONSTRUCTOR_CALL 'private constructor (x: kotlin.Int) [primary] declared in .Test1' + ENUM_CONSTRUCTOR_CALL 'private constructor (x: kotlin.Int) [primary] declared in .Test1' x: CONST Int type=kotlin.Int value=1 INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_ENTRY name:ONE modality:FINAL visibility:private superTypes:[.Test1]' CONSTRUCTOR visibility:private <> () returnType:.Test1 BLOCK_BODY - DELEGATING_CONSTRUCTOR_CALL 'private constructor (x: kotlin.Int) [primary] declared in .Test1' + ENUM_CONSTRUCTOR_CALL 'private constructor (x: kotlin.Int) [primary] declared in .Test1' x: CONST Int type=kotlin.Int value=0 FUN name:values visibility:public modality:FINAL <> ($this:.Test1) returnType:kotlin.Array<.Test1> $this: VALUE_PARAMETER name: type:.Test1 @@ -170,7 +170,7 @@ FILE fqName: fileName:/enumWithSecondaryCtor.kt $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Test2.ZERO CONSTRUCTOR visibility:private <> () returnType:. [primary] BLOCK_BODY - DELEGATING_CONSTRUCTOR_CALL 'private constructor () declared in .Test2' + ENUM_CONSTRUCTOR_CALL 'private constructor () declared in .Test2' INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_ENTRY name:ZERO modality:FINAL visibility:private superTypes:[.Test2]' FUN name:foo visibility:public modality:FINAL <> ($this:.Test2.ZERO) returnType:kotlin.Unit $this: VALUE_PARAMETER name: type:.Test2.ZERO @@ -182,7 +182,7 @@ FILE fqName: fileName:/enumWithSecondaryCtor.kt $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Test2.ONE CONSTRUCTOR visibility:private <> () returnType:. [primary] BLOCK_BODY - DELEGATING_CONSTRUCTOR_CALL 'private constructor (x: kotlin.Int) [primary] declared in .Test2' + ENUM_CONSTRUCTOR_CALL 'private constructor (x: kotlin.Int) [primary] declared in .Test2' x: CONST Int type=kotlin.Int value=1 INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_ENTRY name:ONE modality:FINAL visibility:private superTypes:[.Test2]' FUN name:foo visibility:public modality:FINAL <> ($this:.Test2.ONE) returnType:kotlin.Unit @@ -192,7 +192,7 @@ FILE fqName: fileName:/enumWithSecondaryCtor.kt message: CONST String type=kotlin.String value="ONE" CONSTRUCTOR visibility:private <> () returnType:.Test2 BLOCK_BODY - DELEGATING_CONSTRUCTOR_CALL 'private constructor (x: kotlin.Int) [primary] declared in .Test2' + ENUM_CONSTRUCTOR_CALL 'private constructor (x: kotlin.Int) [primary] declared in .Test2' x: CONST Int type=kotlin.Int value=0 FUN name:foo visibility:public modality:ABSTRACT <> ($this:.Test2) returnType:kotlin.Unit $this: VALUE_PARAMETER name: type:.Test2 diff --git a/compiler/testData/ir/irText/declarations/annotations/enumEntriesWithAnnotations.fir.txt b/compiler/testData/ir/irText/declarations/annotations/enumEntriesWithAnnotations.fir.txt index 10e0ddac81a..4e7affc6071 100644 --- a/compiler/testData/ir/irText/declarations/annotations/enumEntriesWithAnnotations.fir.txt +++ b/compiler/testData/ir/irText/declarations/annotations/enumEntriesWithAnnotations.fir.txt @@ -40,7 +40,7 @@ FILE fqName: fileName:/enumEntriesWithAnnotations.kt $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.TestEnum.ENTRY1 CONSTRUCTOR visibility:private <> () returnType:. [primary] BLOCK_BODY - DELEGATING_CONSTRUCTOR_CALL 'private constructor () [primary] declared in .TestEnum' + ENUM_CONSTRUCTOR_CALL 'private constructor () [primary] declared in .TestEnum' INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_ENTRY name:ENTRY1 modality:FINAL visibility:private superTypes:[.TestEnum]' ENUM_ENTRY name:ENTRY2 class: CLASS ENUM_ENTRY name:ENTRY2 modality:FINAL visibility:private superTypes:[.TestEnum] @@ -49,7 +49,7 @@ FILE fqName: fileName:/enumEntriesWithAnnotations.kt $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.TestEnum.ENTRY2 CONSTRUCTOR visibility:private <> () returnType:. [primary] BLOCK_BODY - DELEGATING_CONSTRUCTOR_CALL 'private constructor () [primary] declared in .TestEnum' + ENUM_CONSTRUCTOR_CALL 'private constructor () [primary] declared in .TestEnum' INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_ENTRY name:ENTRY2 modality:FINAL visibility:private superTypes:[.TestEnum]' PROPERTY name:x visibility:public modality:FINAL [val] FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Int visibility:private [final] diff --git a/compiler/testData/ir/irText/declarations/annotations/enumsInAnnotationArguments.fir.txt b/compiler/testData/ir/irText/declarations/annotations/enumsInAnnotationArguments.fir.txt index 43360bbe2e6..febc1df57c1 100644 --- a/compiler/testData/ir/irText/declarations/annotations/enumsInAnnotationArguments.fir.txt +++ b/compiler/testData/ir/irText/declarations/annotations/enumsInAnnotationArguments.fir.txt @@ -10,28 +10,28 @@ FILE fqName: fileName:/enumsInAnnotationArguments.kt $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.En.A CONSTRUCTOR visibility:private <> () returnType:. [primary] BLOCK_BODY - DELEGATING_CONSTRUCTOR_CALL 'private constructor () [primary] declared in .En' + ENUM_CONSTRUCTOR_CALL 'private constructor () [primary] declared in .En' INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_ENTRY name:A modality:FINAL visibility:private superTypes:[.En]' ENUM_ENTRY name:B class: CLASS ENUM_ENTRY name:B modality:FINAL visibility:private superTypes:[.En] $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.En.B CONSTRUCTOR visibility:private <> () returnType:. [primary] BLOCK_BODY - DELEGATING_CONSTRUCTOR_CALL 'private constructor () [primary] declared in .En' + ENUM_CONSTRUCTOR_CALL 'private constructor () [primary] declared in .En' INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_ENTRY name:B modality:FINAL visibility:private superTypes:[.En]' ENUM_ENTRY name:C class: CLASS ENUM_ENTRY name:C modality:FINAL visibility:private superTypes:[.En] $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.En.C CONSTRUCTOR visibility:private <> () returnType:. [primary] BLOCK_BODY - DELEGATING_CONSTRUCTOR_CALL 'private constructor () [primary] declared in .En' + ENUM_CONSTRUCTOR_CALL 'private constructor () [primary] declared in .En' INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_ENTRY name:C modality:FINAL visibility:private superTypes:[.En]' ENUM_ENTRY name:D class: CLASS ENUM_ENTRY name:D modality:FINAL visibility:private superTypes:[.En] $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.En.D CONSTRUCTOR visibility:private <> () returnType:. [primary] BLOCK_BODY - DELEGATING_CONSTRUCTOR_CALL 'private constructor () [primary] declared in .En' + ENUM_CONSTRUCTOR_CALL 'private constructor () [primary] declared in .En' INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_ENTRY name:D modality:FINAL visibility:private superTypes:[.En]' FUN name:values visibility:public modality:FINAL <> ($this:.En) returnType:kotlin.Array<.En> $this: VALUE_PARAMETER name: type:.En diff --git a/compiler/testData/ir/irText/declarations/multiplatform/expectedEnumClass.fir.txt b/compiler/testData/ir/irText/declarations/multiplatform/expectedEnumClass.fir.txt index bb906e9db61..42dbc3fe3df 100644 --- a/compiler/testData/ir/irText/declarations/multiplatform/expectedEnumClass.fir.txt +++ b/compiler/testData/ir/irText/declarations/multiplatform/expectedEnumClass.fir.txt @@ -10,14 +10,14 @@ FILE fqName: fileName:/expectedEnumClass.kt $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.MyEnum.FOO CONSTRUCTOR visibility:private <> () returnType:. [primary] BLOCK_BODY - DELEGATING_CONSTRUCTOR_CALL 'private constructor () [primary] declared in .MyEnum' + ENUM_CONSTRUCTOR_CALL 'private constructor () [primary] declared in .MyEnum' INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_ENTRY name:FOO modality:FINAL visibility:private superTypes:[.MyEnum]' ENUM_ENTRY name:BAR class: CLASS ENUM_ENTRY name:BAR modality:FINAL visibility:private superTypes:[.MyEnum] $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.MyEnum.BAR CONSTRUCTOR visibility:private <> () returnType:. [primary] BLOCK_BODY - DELEGATING_CONSTRUCTOR_CALL 'private constructor () [primary] declared in .MyEnum' + ENUM_CONSTRUCTOR_CALL 'private constructor () [primary] declared in .MyEnum' INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_ENTRY name:BAR modality:FINAL visibility:private superTypes:[.MyEnum]' FUN name:values visibility:public modality:FINAL <> ($this:.MyEnum) returnType:kotlin.Array<.MyEnum> $this: VALUE_PARAMETER name: type:.MyEnum @@ -71,21 +71,21 @@ FILE fqName: fileName:/expectedEnumClass.kt $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.MyEnum.FOO CONSTRUCTOR visibility:private <> () returnType:. [primary] BLOCK_BODY - DELEGATING_CONSTRUCTOR_CALL 'private constructor () [primary] declared in .MyEnum' + ENUM_CONSTRUCTOR_CALL 'private constructor () [primary] declared in .MyEnum' INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_ENTRY name:FOO modality:FINAL visibility:private superTypes:[.MyEnum]' ENUM_ENTRY name:BAR class: CLASS ENUM_ENTRY name:BAR modality:FINAL visibility:private superTypes:[.MyEnum] $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.MyEnum.BAR CONSTRUCTOR visibility:private <> () returnType:. [primary] BLOCK_BODY - DELEGATING_CONSTRUCTOR_CALL 'private constructor () [primary] declared in .MyEnum' + ENUM_CONSTRUCTOR_CALL 'private constructor () [primary] declared in .MyEnum' INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_ENTRY name:BAR modality:FINAL visibility:private superTypes:[.MyEnum]' ENUM_ENTRY name:BAZ class: CLASS ENUM_ENTRY name:BAZ modality:FINAL visibility:private superTypes:[.MyEnum] $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.MyEnum.BAZ CONSTRUCTOR visibility:private <> () returnType:. [primary] BLOCK_BODY - DELEGATING_CONSTRUCTOR_CALL 'private constructor () [primary] declared in .MyEnum' + ENUM_CONSTRUCTOR_CALL 'private constructor () [primary] declared in .MyEnum' INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_ENTRY name:BAZ modality:FINAL visibility:private superTypes:[.MyEnum]' FUN name:values visibility:public modality:FINAL <> ($this:.MyEnum) returnType:kotlin.Array<.MyEnum> $this: VALUE_PARAMETER name: type:.MyEnum diff --git a/compiler/testData/ir/irText/expressions/enumEntryAsReceiver.fir.txt b/compiler/testData/ir/irText/expressions/enumEntryAsReceiver.fir.txt index 20f86081b7a..10a0bfeb53c 100644 --- a/compiler/testData/ir/irText/expressions/enumEntryAsReceiver.fir.txt +++ b/compiler/testData/ir/irText/expressions/enumEntryAsReceiver.fir.txt @@ -10,7 +10,7 @@ FILE fqName: fileName:/enumEntryAsReceiver.kt $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.X.B CONSTRUCTOR visibility:private <> () returnType:. [primary] BLOCK_BODY - DELEGATING_CONSTRUCTOR_CALL 'private constructor () [primary] declared in .X' + ENUM_CONSTRUCTOR_CALL 'private constructor () [primary] declared in .X' INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_ENTRY name:B modality:FINAL visibility:private superTypes:[.X]' PROPERTY name:value2 visibility:public modality:FINAL [val] FIELD PROPERTY_BACKING_FIELD name:value2 type:kotlin.String visibility:private [final] diff --git a/compiler/testData/ir/irText/expressions/enumEntryReferenceFromEnumEntryClass.fir.txt b/compiler/testData/ir/irText/expressions/enumEntryReferenceFromEnumEntryClass.fir.txt index d6873ffb43b..faf5d0e3cf4 100644 --- a/compiler/testData/ir/irText/expressions/enumEntryReferenceFromEnumEntryClass.fir.txt +++ b/compiler/testData/ir/irText/expressions/enumEntryReferenceFromEnumEntryClass.fir.txt @@ -10,7 +10,7 @@ FILE fqName: fileName:/enumEntryReferenceFromEnumEntryClass.kt $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.MyEnum.Z CONSTRUCTOR visibility:private <> () returnType:. [primary] BLOCK_BODY - DELEGATING_CONSTRUCTOR_CALL 'private constructor () [primary] declared in .MyEnum' + ENUM_CONSTRUCTOR_CALL 'private constructor () [primary] declared in .MyEnum' INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_ENTRY name:Z modality:FINAL visibility:private superTypes:[.MyEnum]' PROPERTY name:counter visibility:public modality:FINAL [var] FIELD PROPERTY_BACKING_FIELD name:counter type:kotlin.Int visibility:private diff --git a/compiler/testData/ir/irText/expressions/objectAsCallable.fir.txt b/compiler/testData/ir/irText/expressions/objectAsCallable.fir.txt index 9874844b6c5..07aff92790a 100644 --- a/compiler/testData/ir/irText/expressions/objectAsCallable.fir.txt +++ b/compiler/testData/ir/irText/expressions/objectAsCallable.fir.txt @@ -29,7 +29,7 @@ FILE fqName: fileName:/objectAsCallable.kt $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.En.X CONSTRUCTOR visibility:private <> () returnType:. [primary] BLOCK_BODY - DELEGATING_CONSTRUCTOR_CALL 'private constructor () [primary] declared in .En' + ENUM_CONSTRUCTOR_CALL 'private constructor () [primary] declared in .En' INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_ENTRY name:X modality:FINAL visibility:private superTypes:[.En]' FUN name:values visibility:public modality:FINAL <> ($this:.En) returnType:kotlin.Array<.En> $this: VALUE_PARAMETER name: type:.En diff --git a/compiler/testData/ir/irText/expressions/temporaryInEnumEntryInitializer.fir.txt b/compiler/testData/ir/irText/expressions/temporaryInEnumEntryInitializer.fir.txt index cbd9bc26899..e7608c6868e 100644 --- a/compiler/testData/ir/irText/expressions/temporaryInEnumEntryInitializer.fir.txt +++ b/compiler/testData/ir/irText/expressions/temporaryInEnumEntryInitializer.fir.txt @@ -31,7 +31,7 @@ FILE fqName: fileName:/temporaryInEnumEntryInitializer.kt $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.En.ENTRY CONSTRUCTOR visibility:private <> () returnType:. [primary] BLOCK_BODY - DELEGATING_CONSTRUCTOR_CALL 'private constructor (x: kotlin.String?) [primary] declared in .En' + 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 $this: CALL 'public final fun (): kotlin.Any? declared in ' type=kotlin.Any? origin=null INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_ENTRY name:ENTRY modality:FINAL visibility:private superTypes:[.En]' diff --git a/compiler/testData/ir/irText/expressions/values.fir.txt b/compiler/testData/ir/irText/expressions/values.fir.txt index fb82d33325f..5e132ea7dcd 100644 --- a/compiler/testData/ir/irText/expressions/values.fir.txt +++ b/compiler/testData/ir/irText/expressions/values.fir.txt @@ -10,7 +10,7 @@ FILE fqName: fileName:/values.kt $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Enum.A CONSTRUCTOR visibility:private <> () returnType:. [primary] BLOCK_BODY - DELEGATING_CONSTRUCTOR_CALL 'private constructor () [primary] declared in .Enum' + ENUM_CONSTRUCTOR_CALL 'private constructor () [primary] declared in .Enum' INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_ENTRY name:A modality:FINAL visibility:private superTypes:[.Enum]' FUN name:values visibility:public modality:FINAL <> ($this:.Enum) returnType:kotlin.Array<.Enum> $this: VALUE_PARAMETER name: type:.Enum diff --git a/compiler/testData/ir/irText/singletons/enumEntry.fir.txt b/compiler/testData/ir/irText/singletons/enumEntry.fir.txt index 5f49a68782d..341d832abae 100644 --- a/compiler/testData/ir/irText/singletons/enumEntry.fir.txt +++ b/compiler/testData/ir/irText/singletons/enumEntry.fir.txt @@ -10,7 +10,7 @@ FILE fqName: fileName:/enumEntry.kt $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Z.ENTRY CONSTRUCTOR visibility:private <> () returnType:. [primary] BLOCK_BODY - DELEGATING_CONSTRUCTOR_CALL 'private constructor () [primary] declared in .Z' + ENUM_CONSTRUCTOR_CALL 'private constructor () [primary] declared in .Z' INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_ENTRY name:ENTRY modality:FINAL visibility:private superTypes:[.Z]' FUN name:test visibility:public modality:FINAL <> ($this:.Z.ENTRY) returnType:kotlin.Unit $this: VALUE_PARAMETER name: type:.Z.ENTRY