[FIR] Don't create initializers for simple enum entries

Usually FIR enum entry is initialized by anonymous object,
which is the container for all enum entry' declarations.
However, for simple enum entries there is no need of initializer at all.
This commit is contained in:
Mikhail Glukhikh
2020-02-20 11:08:34 +03:00
parent b1e9dbf994
commit 39bd97147f
39 changed files with 266 additions and 277 deletions
@@ -316,6 +316,12 @@ class DeclarationsConverter(
}
}
private fun LighterASTNode.hasValueParameters(): Boolean {
return getChildNodesByType(VALUE_PARAMETER_LIST).let {
it.isNotEmpty() && it.first().getChildNodesByType(VALUE_PARAMETER).isNotEmpty()
}
}
/***** DECLARATIONS *****/
/**
* @see org.jetbrains.kotlin.parsing.KotlinParsing.parseClassOrObject
@@ -417,9 +423,12 @@ class DeclarationsConverter(
this.superTypeRefs += superTypeRefs
val secondaryConstructors = classBody.getChildNodesByType(SECONDARY_CONSTRUCTOR)
val classWrapper = ClassWrapper(
className, modifiers, classKind, primaryConstructor != null,
classBody.getChildNodesByType(SECONDARY_CONSTRUCTOR).isNotEmpty(),
secondaryConstructors.isNotEmpty(),
if (primaryConstructor != null) !primaryConstructor!!.hasValueParameters()
else secondaryConstructors.isEmpty() || secondaryConstructors.any { !it.hasValueParameters() },
selfType,
delegatedSuperTypeRef ?: defaultDelegatedSuperTypeRef, superTypeCallEntry
)
@@ -503,6 +512,7 @@ class DeclarationsConverter(
val classWrapper = ClassWrapper(
SpecialNames.NO_NAME_PROVIDED, modifiers, ClassKind.OBJECT, hasPrimaryConstructor = false,
hasSecondaryConstructor = classBody.getChildNodesByType(SECONDARY_CONSTRUCTOR).isNotEmpty(),
hasDefaultConstructor = false,
delegatedSelfTypeRef = delegatedType,
delegatedSuperTypeRef = delegatedType,
superTypeCallEntry = superTypeCallEntry
@@ -541,6 +551,15 @@ class DeclarationsConverter(
session = baseSession
returnTypeRef = classWrapper.delegatedSelfTypeRef
name = enumEntryName
symbol = FirVariableSymbol(CallableId(context.currentClassId, enumEntryName))
status = FirDeclarationStatusImpl(Visibilities.PUBLIC, Modality.FINAL).apply {
isStatic = true
}
if (classWrapper.hasDefaultConstructor && enumEntry.getChildNodeByType(INITIALIZER_LIST) == null &&
modifiers.annotations.isEmpty() && classBodyNode == null
) {
return@buildEnumEntry
}
initializer = withChildClassName(enumEntryName) {
buildAnonymousObject {
source = this@buildEnumEntry.source
@@ -552,6 +571,7 @@ class DeclarationsConverter(
val enumClassWrapper = ClassWrapper(
enumEntryName, modifiers, ClassKind.ENUM_ENTRY, hasPrimaryConstructor = true,
hasSecondaryConstructor = classBodyNode.getChildNodesByType(SECONDARY_CONSTRUCTOR).isNotEmpty(),
hasDefaultConstructor = false,
delegatedSelfTypeRef = buildResolvedTypeRef {
type = ConeClassLikeTypeImpl(
this@buildAnonymousObject.symbol.toLookupTag(),
@@ -567,10 +587,6 @@ class DeclarationsConverter(
classBodyNode?.also { declarations += convertClassBody(it, enumClassWrapper) }
}
}
symbol = FirVariableSymbol(CallableId(context.currentClassId, enumEntryName))
status = FirDeclarationStatusImpl(Visibilities.PUBLIC, Modality.FINAL).apply {
isStatic = true
}
}
}
@@ -21,6 +21,7 @@ class ClassWrapper(
private val classKind: ClassKind,
val hasPrimaryConstructor: Boolean,
val hasSecondaryConstructor: Boolean,
val hasDefaultConstructor: Boolean,
val delegatedSelfTypeRef: FirTypeRef,
val delegatedSuperTypeRef: FirTypeRef,
val superTypeCallEntry: MutableList<FirExpression>
@@ -154,16 +154,25 @@ class RawFirBuilder(
delegatedSuperType: FirTypeRef?, delegatedSelfType: FirResolvedTypeRef?, owner: KtClassOrObject, hasPrimaryConstructor: Boolean,
): FirDeclaration {
return when (this) {
is KtSecondaryConstructor -> toFirConstructor(
delegatedSuperType,
delegatedSelfType ?: buildErrorTypeRef {
source = this@toFirDeclaration.toFirSourceElement()
diagnostic = FirSimpleDiagnostic("Constructor in object", DiagnosticKind.ConstructorInObject)
},
owner,
hasPrimaryConstructor,
)
is KtEnumEntry -> toFirEnumEntry(delegatedSelfType!!)
is KtSecondaryConstructor -> {
toFirConstructor(
delegatedSuperType,
delegatedSelfType ?: buildErrorTypeRef {
source = this@toFirDeclaration.toFirSourceElement()
diagnostic = FirSimpleDiagnostic("Constructor in object", DiagnosticKind.ConstructorInObject)
},
owner,
hasPrimaryConstructor,
)
}
is KtEnumEntry -> {
val primaryConstructor = owner.primaryConstructor
val ownerClassHasDefaultConstructor =
primaryConstructor?.valueParameters?.isEmpty() ?: owner.secondaryConstructors.let { constructors ->
constructors.isEmpty() || constructors.any { it.valueParameters.isEmpty() }
}
toFirEnumEntry(delegatedSelfType!!, ownerClassHasDefaultConstructor)
}
else -> convert()
}
}
@@ -518,13 +527,26 @@ class RawFirBuilder(
}
}
private fun KtEnumEntry.toFirEnumEntry(delegatedEnumSelfTypeRef: FirResolvedTypeRef): FirDeclaration {
private fun KtEnumEntry.toFirEnumEntry(
delegatedEnumSelfTypeRef: FirResolvedTypeRef,
ownerClassHasDefaultConstructor: Boolean
): FirDeclaration {
val ktEnumEntry = this@toFirEnumEntry
return buildEnumEntry {
source = toFirSourceElement()
session = baseSession
returnTypeRef = delegatedEnumSelfTypeRef
name = nameAsSafeName
status = FirDeclarationStatusImpl(Visibilities.PUBLIC, Modality.FINAL).apply {
isStatic = true
}
symbol = FirVariableSymbol(callableIdForName(nameAsSafeName))
// NB: not sure should annotations be on enum entry itself, or on its corresponding object
if (ownerClassHasDefaultConstructor && ktEnumEntry.initializerList == null &&
ktEnumEntry.annotationEntries.isEmpty() && ktEnumEntry.body == null
) {
return@buildEnumEntry
}
initializer = withChildClassName(nameAsSafeName) {
buildAnonymousObject {
source = toFirSourceElement()
@@ -559,12 +581,6 @@ class RawFirBuilder(
}
}
}
status = FirDeclarationStatusImpl(
Visibilities.PUBLIC, Modality.FINAL,
).apply {
isStatic = true
}
symbol = FirVariableSymbol(callableIdForName(nameAsSafeName))
}
}
@@ -30,4 +30,17 @@ enum class Planet(val m: Double, internal val r: Double) {
companion object {
const val G = 6.67e-11
}
}
enum class PseudoInsn(val signature: String = "()V") {
FIX_STACK_BEFORE_JUMP,
FAKE_ALWAYS_TRUE_IFEQ("()I"),
FAKE_ALWAYS_FALSE_IFEQ("()I"),
SAVE_STACK_BEFORE_TRY,
RESTORE_STACK_IN_TRY_CATCH,
STORE_NOT_NULL,
AS_NOT_NULL("(Ljava/lang/Object;)Ljava/lang/Object;")
;
fun emit() {}
}
@@ -4,27 +4,9 @@ FILE: enums.kt
super<R|kotlin/Enum<Order>|>()
}
public final static enum entry FIRST: R|Order| = object : R|Order| {
public? constructor(): R|anonymous| {
super<R|Order|>()
}
}
public final static enum entry SECOND: R|Order| = object : R|Order| {
public? constructor(): R|anonymous| {
super<R|Order|>()
}
}
public final static enum entry THIRD: R|Order| = object : R|Order| {
public? constructor(): R|anonymous| {
super<R|Order|>()
}
}
public final static enum entry FIRST: R|Order|
public final static enum entry SECOND: R|Order|
public final static enum entry THIRD: R|Order|
public final static fun values(): R|kotlin/Array<Order>| {
}
@@ -98,3 +80,70 @@ FILE: enums.kt
}
}
public? final? enum class PseudoInsn : R|kotlin/Enum<PseudoInsn>| {
public? constructor(signature: String = String(()V)): R|PseudoInsn| {
super<R|kotlin/Enum<PseudoInsn>|>()
}
public? final? val signature: String = R|<local>/signature|
public? get(): String
public final static enum entry FIX_STACK_BEFORE_JUMP: R|PseudoInsn| = object : R|PseudoInsn| {
public? constructor(): R|anonymous| {
super<R|PseudoInsn|>()
}
}
public final static enum entry FAKE_ALWAYS_TRUE_IFEQ: R|PseudoInsn| = object : R|PseudoInsn| {
public? constructor(): R|anonymous| {
super<R|PseudoInsn|>(String(()I))
}
}
public final static enum entry FAKE_ALWAYS_FALSE_IFEQ: R|PseudoInsn| = object : R|PseudoInsn| {
public? constructor(): R|anonymous| {
super<R|PseudoInsn|>(String(()I))
}
}
public final static enum entry SAVE_STACK_BEFORE_TRY: R|PseudoInsn| = object : R|PseudoInsn| {
public? constructor(): R|anonymous| {
super<R|PseudoInsn|>()
}
}
public final static enum entry RESTORE_STACK_IN_TRY_CATCH: R|PseudoInsn| = object : R|PseudoInsn| {
public? constructor(): R|anonymous| {
super<R|PseudoInsn|>()
}
}
public final static enum entry STORE_NOT_NULL: R|PseudoInsn| = object : R|PseudoInsn| {
public? constructor(): R|anonymous| {
super<R|PseudoInsn|>()
}
}
public final static enum entry AS_NOT_NULL: R|PseudoInsn| = object : R|PseudoInsn| {
public? constructor(): R|anonymous| {
super<R|PseudoInsn|>(String((Ljava/lang/Object;)Ljava/lang/Object;))
}
}
public? final? fun emit(): R|kotlin/Unit| {
}
public final static fun values(): R|kotlin/Array<PseudoInsn>| {
}
public final static fun valueOf(value: R|kotlin/String|): R|PseudoInsn| {
}
}
+21
View File
@@ -13,4 +13,25 @@ enum class SomeEnum(val x: Some) {
};
abstract fun check(y: Some): Boolean
}
enum class E {
A; // no constructor call needed
constructor()
}
enum class EnumClass {
E1 {
override fun foo() = 1
override val bar: String = "a"
},
E2 {
},
E3();
abstract fun foo(): Int
abstract val bar: String
}
+58
View File
@@ -52,3 +52,61 @@ FILE: enum.kt
}
}
public final enum class E : R|kotlin/Enum<E>| {
public final static enum entry A: R|E|
private constructor(): R|E| {
super<R|kotlin/Enum<E>|>()
}
public final static fun values(): R|kotlin/Array<E>| {
}
public final static fun valueOf(value: R|kotlin/String|): R|E| {
}
}
public final enum class EnumClass : R|kotlin/Enum<EnumClass>| {
private constructor(): R|EnumClass| {
super<R|kotlin/Enum<EnumClass>|>()
}
public final static enum entry E1: R|EnumClass| = object : R|EnumClass| {
private constructor(): R|anonymous| {
super<R|EnumClass|>()
}
public final override fun foo(): R|kotlin/Int| {
^foo Int(1)
}
public final override val bar: R|kotlin/String| = String(a)
public get(): R|kotlin/String|
}
public final static enum entry E2: R|EnumClass| = object : R|EnumClass| {
private constructor(): R|anonymous| {
super<R|EnumClass|>()
}
}
public final static enum entry E3: R|EnumClass| = object : R|EnumClass| {
private constructor(): R|anonymous| {
super<R|EnumClass|>()
}
}
public abstract fun foo(): R|kotlin/Int|
public abstract val bar: R|kotlin/String|
public get(): R|kotlin/String|
public final static fun values(): R|kotlin/Array<EnumClass>| {
}
public final static fun valueOf(value: R|kotlin/String|): R|EnumClass| {
}
}
+2 -14
View File
@@ -4,20 +4,8 @@ FILE: enumWithCompanion.kt
super<R|kotlin/Enum<EC>|>()
}
public final static enum entry A: R|EC| = object : R|EC| {
private constructor(): R|anonymous| {
super<R|EC|>()
}
}
public final static enum entry B: R|EC| = object : R|EC| {
private constructor(): R|anonymous| {
super<R|EC|>()
}
}
public final static enum entry A: R|EC|
public final static enum entry B: R|EC|
public final companion object Companion : R|kotlin/Any| {
private constructor(): R|EC.Companion| {
super<R|kotlin/Any|>()
@@ -4,27 +4,9 @@ FILE: main.kt
super<R|kotlin/Enum<E>|>()
}
public final static enum entry A: R|E| = object : R|E| {
private constructor(): R|anonymous| {
super<R|E|>()
}
}
public final static enum entry B: R|E| = object : R|E| {
private constructor(): R|anonymous| {
super<R|E|>()
}
}
public final static enum entry C: R|E| = object : R|E| {
private constructor(): R|anonymous| {
super<R|E|>()
}
}
public final static enum entry A: R|E|
public final static enum entry B: R|E|
public final static enum entry C: R|E|
public final static fun values(): R|kotlin/Array<E>| {
}
@@ -4,27 +4,9 @@ FILE: exhaustiveness_enum.kt
super<R|kotlin/Enum<Enum>|>()
}
public final static enum entry A: R|Enum| = object : R|Enum| {
private constructor(): R|anonymous| {
super<R|Enum|>()
}
}
public final static enum entry B: R|Enum| = object : R|Enum| {
private constructor(): R|anonymous| {
super<R|Enum|>()
}
}
public final static enum entry C: R|Enum| = object : R|Enum| {
private constructor(): R|anonymous| {
super<R|Enum|>()
}
}
public final static enum entry A: R|Enum|
public final static enum entry B: R|Enum|
public final static enum entry C: R|Enum|
public final static fun values(): R|kotlin/Array<Enum>| {
}
@@ -4,20 +4,8 @@ FILE: enumEntryUse.kt
super<R|kotlin/Enum<TestEnum>|>()
}
public final static enum entry FIRST: R|TestEnum| = object : R|TestEnum| {
private constructor(): R|anonymous| {
super<R|TestEnum|>()
}
}
public final static enum entry SECOND: R|TestEnum| = object : R|TestEnum| {
private constructor(): R|anonymous| {
super<R|TestEnum|>()
}
}
public final static enum entry FIRST: R|TestEnum|
public final static enum entry SECOND: R|TestEnum|
public final static enum entry THIRD: R|TestEnum| = object : R|TestEnum| {
private constructor(): R|anonymous| {
super<R|TestEnum|>()
@@ -4,27 +4,9 @@ FILE: enumValues.kt
super<R|kotlin/Enum<MyEnum>|>()
}
public final static enum entry FIRST: R|MyEnum| = object : R|MyEnum| {
private constructor(): R|anonymous| {
super<R|MyEnum|>()
}
}
public final static enum entry SECOND: R|MyEnum| = object : R|MyEnum| {
private constructor(): R|anonymous| {
super<R|MyEnum|>()
}
}
public final static enum entry LAST: R|MyEnum| = object : R|MyEnum| {
private constructor(): R|anonymous| {
super<R|MyEnum|>()
}
}
public final static enum entry FIRST: R|MyEnum|
public final static enum entry SECOND: R|MyEnum|
public final static enum entry LAST: R|MyEnum|
public final fun bar(): R|kotlin/Int| {
^bar Int(42)
}
@@ -33,13 +33,7 @@ FILE: qualifiedExpressions.kt
super<R|kotlin/Enum<a/b/E>|>()
}
public final static enum entry entry: R|a/b/E| = object : R|a/b/E| {
private constructor(): R|anonymous| {
super<R|a/b/E|>()
}
}
public final static enum entry entry: R|a/b/E|
public final static fun values(): R|kotlin/Array<a/b/E>| {
}
@@ -66,13 +66,7 @@ FILE: qualifierPriority.kt
super<R|kotlin/Enum<G>|>()
}
public final static enum entry H: R|G| = object : R|G| {
private constructor(): R|anonymous| {
super<R|G|>()
}
}
public final static enum entry H: R|G|
public final fun foo(): R|kotlin/Unit| {
R|/G.values|()
}
+3 -21
View File
@@ -4,27 +4,9 @@ FILE: enums.kt
super<R|kotlin/Enum<Order>|>()
}
public final static enum entry FIRST: R|Order| = object : R|Order| {
private constructor(): R|anonymous| {
super<R|Order|>()
}
}
public final static enum entry SECOND: R|Order| = object : R|Order| {
private constructor(): R|anonymous| {
super<R|Order|>()
}
}
public final static enum entry THIRD: R|Order| = object : R|Order| {
private constructor(): R|anonymous| {
super<R|Order|>()
}
}
public final static enum entry FIRST: R|Order|
public final static enum entry SECOND: R|Order|
public final static enum entry THIRD: R|Order|
public final static fun values(): R|kotlin/Array<Order>| {
}
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
enum class A {
ONE,
TWO;
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
enum class A {
ONE,
TWO
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
import A.ONE
enum class A {
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
import A.ONE
enum class A {
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
enum class E {
ENTRY;
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// http://youtrack.jetbrains.com/issue/KT-2167
enum class Season {
-1
View File
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
package test
enum class Season {
-1
View File
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
class A {
enum class E {
OK
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
class A {
companion object {}
enum class E {
-1
View File
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
enum class Bar {
ONE,
TWO
-1
View File
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
enum class Season {
WINTER,
SPRING,
-1
View File
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// KJS_WITH_FULL_RUNTIME
// WITH_RUNTIME
-1
View File
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
enum class State {
O,
K
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
class Outer {
enum class Nested {
O,
-1
View File
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
enum class A { X1, X2 }
fun box(): String {
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// CHECK_CASES_COUNT: function=box count=0
// CHECK_IF_COUNT: function=box count=1
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// WITH_RUNTIME
// CHECK_CASES_COUNT: function=foo count=0
// CHECK_IF_COUNT: function=foo count=3
@@ -1,6 +1,6 @@
enum interface Some {
// Enum part
<!UNRESOLVED_REFERENCE!>D;<!>
D;
// Interface like part
fun test()
+4 -12
View File
@@ -7,19 +7,11 @@ FILE fqName:<root> fileName:/enum.kt
<E>: <root>.TestEnum1
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_CLASS name:TestEnum1 modality:FINAL visibility:public superTypes:[kotlin.Enum<<root>.TestEnum1>]'
ENUM_ENTRY name:TEST1
class: CLASS ENUM_ENTRY name:TEST1 modality:FINAL visibility:private superTypes:[<root>.TestEnum1]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.TestEnum1.TEST1
CONSTRUCTOR visibility:private <> () returnType:<uninitialized parent>.<anonymous> [primary]
BLOCK_BODY
ENUM_CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.TestEnum1'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_ENTRY name:TEST1 modality:FINAL visibility:private superTypes:[<root>.TestEnum1]'
init: EXPRESSION_BODY
ENUM_CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.TestEnum1'
ENUM_ENTRY name:TEST2
class: CLASS ENUM_ENTRY name:TEST2 modality:FINAL visibility:private superTypes:[<root>.TestEnum1]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.TestEnum1.TEST2
CONSTRUCTOR visibility:private <> () returnType:<uninitialized parent>.<anonymous> [primary]
BLOCK_BODY
ENUM_CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.TestEnum1'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_ENTRY name:TEST2 modality:FINAL visibility:private superTypes:[<root>.TestEnum1]'
init: EXPRESSION_BODY
ENUM_CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.TestEnum1'
FUN name:values visibility:public modality:FINAL <> ($this:<root>.TestEnum1) returnType:kotlin.Array<<root>.TestEnum1>
$this: VALUE_PARAMETER name:<this> type:<root>.TestEnum1
BLOCK_BODY
@@ -7,12 +7,8 @@ FILE fqName:<root> fileName:/enumClassModality.kt
<E>: <root>.TestFinalEnum1
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_CLASS name:TestFinalEnum1 modality:FINAL visibility:public superTypes:[kotlin.Enum<<root>.TestFinalEnum1>]'
ENUM_ENTRY name:X1
class: CLASS ENUM_ENTRY name:X1 modality:FINAL visibility:private superTypes:[<root>.TestFinalEnum1]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.TestFinalEnum1.X1
CONSTRUCTOR visibility:private <> () returnType:<uninitialized parent>.<anonymous> [primary]
BLOCK_BODY
ENUM_CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.TestFinalEnum1'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_ENTRY name:X1 modality:FINAL visibility:private superTypes:[<root>.TestFinalEnum1]'
init: EXPRESSION_BODY
ENUM_CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.TestFinalEnum1'
FUN name:values visibility:public modality:FINAL <> ($this:<root>.TestFinalEnum1) returnType:kotlin.Array<<root>.TestFinalEnum1>
$this: VALUE_PARAMETER name:<this> type:<root>.TestFinalEnum1
BLOCK_BODY
@@ -130,12 +126,8 @@ FILE fqName:<root> fileName:/enumClassModality.kt
<E>: <root>.TestFinalEnum3
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_CLASS name:TestFinalEnum3 modality:FINAL visibility:public superTypes:[kotlin.Enum<<root>.TestFinalEnum3>]'
ENUM_ENTRY name:X1
class: CLASS ENUM_ENTRY name:X1 modality:FINAL visibility:private superTypes:[<root>.TestFinalEnum3]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.TestFinalEnum3.X1
CONSTRUCTOR visibility:private <> () returnType:<uninitialized parent>.<anonymous> [primary]
BLOCK_BODY
ENUM_CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.TestFinalEnum3'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_ENTRY name:X1 modality:FINAL visibility:private superTypes:[<root>.TestFinalEnum3]'
init: EXPRESSION_BODY
ENUM_CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.TestFinalEnum3'
FUN name:doStuff visibility:public modality:FINAL <> ($this:<root>.TestFinalEnum3) returnType:kotlin.Unit
$this: VALUE_PARAMETER name:<this> type:<root>.TestFinalEnum3
BLOCK_BODY
@@ -7,33 +7,17 @@ FILE fqName:<root> fileName:/enumsInAnnotationArguments.kt
<E>: <root>.En
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_CLASS name:En modality:FINAL visibility:public superTypes:[kotlin.Enum<<root>.En>]'
ENUM_ENTRY name:A
class: CLASS ENUM_ENTRY name:A modality:FINAL visibility:private superTypes:[<root>.En]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.En.A
CONSTRUCTOR visibility:private <> () returnType:<uninitialized parent>.<anonymous> [primary]
BLOCK_BODY
ENUM_CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.En'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_ENTRY name:A modality:FINAL visibility:private superTypes:[<root>.En]'
init: EXPRESSION_BODY
ENUM_CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.En'
ENUM_ENTRY name:B
class: CLASS ENUM_ENTRY name:B modality:FINAL visibility:private superTypes:[<root>.En]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.En.B
CONSTRUCTOR visibility:private <> () returnType:<uninitialized parent>.<anonymous> [primary]
BLOCK_BODY
ENUM_CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.En'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_ENTRY name:B modality:FINAL visibility:private superTypes:[<root>.En]'
init: EXPRESSION_BODY
ENUM_CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.En'
ENUM_ENTRY name:C
class: CLASS ENUM_ENTRY name:C modality:FINAL visibility:private superTypes:[<root>.En]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.En.C
CONSTRUCTOR visibility:private <> () returnType:<uninitialized parent>.<anonymous> [primary]
BLOCK_BODY
ENUM_CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.En'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_ENTRY name:C modality:FINAL visibility:private superTypes:[<root>.En]'
init: EXPRESSION_BODY
ENUM_CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.En'
ENUM_ENTRY name:D
class: CLASS ENUM_ENTRY name:D modality:FINAL visibility:private superTypes:[<root>.En]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.En.D
CONSTRUCTOR visibility:private <> () returnType:<uninitialized parent>.<anonymous> [primary]
BLOCK_BODY
ENUM_CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.En'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_ENTRY name:D modality:FINAL visibility:private superTypes:[<root>.En]'
init: EXPRESSION_BODY
ENUM_CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.En'
FUN name:values visibility:public modality:FINAL <> ($this:<root>.En) returnType:kotlin.Array<<root>.En>
$this: VALUE_PARAMETER name:<this> type:<root>.En
BLOCK_BODY
@@ -7,19 +7,11 @@ FILE fqName:<root> fileName:/expectedEnumClass.kt
<E>: <root>.MyEnum
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_CLASS name:MyEnum modality:FINAL visibility:public [expect] superTypes:[kotlin.Enum<<root>.MyEnum>]'
ENUM_ENTRY name:FOO
class: CLASS ENUM_ENTRY name:FOO modality:FINAL visibility:private superTypes:[<root>.MyEnum]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.MyEnum.FOO
CONSTRUCTOR visibility:private <> () returnType:<uninitialized parent>.<anonymous> [primary]
BLOCK_BODY
ENUM_CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.MyEnum'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_ENTRY name:FOO modality:FINAL visibility:private superTypes:[<root>.MyEnum]'
init: EXPRESSION_BODY
ENUM_CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.MyEnum'
ENUM_ENTRY name:BAR
class: CLASS ENUM_ENTRY name:BAR modality:FINAL visibility:private superTypes:[<root>.MyEnum]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.MyEnum.BAR
CONSTRUCTOR visibility:private <> () returnType:<uninitialized parent>.<anonymous> [primary]
BLOCK_BODY
ENUM_CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.MyEnum'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_ENTRY name:BAR modality:FINAL visibility:private superTypes:[<root>.MyEnum]'
init: EXPRESSION_BODY
ENUM_CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.MyEnum'
FUN name:values visibility:public modality:FINAL <> ($this:<root>.MyEnum) returnType:kotlin.Array<<root>.MyEnum>
$this: VALUE_PARAMETER name:<this> type:<root>.MyEnum
BLOCK_BODY
@@ -69,26 +61,14 @@ FILE fqName:<root> fileName:/expectedEnumClass.kt
<E>: <root>.MyEnum
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_CLASS name:MyEnum modality:FINAL visibility:public superTypes:[kotlin.Enum<<root>.MyEnum>]'
ENUM_ENTRY name:FOO
class: CLASS ENUM_ENTRY name:FOO modality:FINAL visibility:private superTypes:[<root>.MyEnum]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.MyEnum.FOO
CONSTRUCTOR visibility:private <> () returnType:<uninitialized parent>.<anonymous> [primary]
BLOCK_BODY
ENUM_CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.MyEnum'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_ENTRY name:FOO modality:FINAL visibility:private superTypes:[<root>.MyEnum]'
init: EXPRESSION_BODY
ENUM_CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.MyEnum'
ENUM_ENTRY name:BAR
class: CLASS ENUM_ENTRY name:BAR modality:FINAL visibility:private superTypes:[<root>.MyEnum]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.MyEnum.BAR
CONSTRUCTOR visibility:private <> () returnType:<uninitialized parent>.<anonymous> [primary]
BLOCK_BODY
ENUM_CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.MyEnum'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_ENTRY name:BAR modality:FINAL visibility:private superTypes:[<root>.MyEnum]'
init: EXPRESSION_BODY
ENUM_CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.MyEnum'
ENUM_ENTRY name:BAZ
class: CLASS ENUM_ENTRY name:BAZ modality:FINAL visibility:private superTypes:[<root>.MyEnum]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.MyEnum.BAZ
CONSTRUCTOR visibility:private <> () returnType:<uninitialized parent>.<anonymous> [primary]
BLOCK_BODY
ENUM_CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.MyEnum'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_ENTRY name:BAZ modality:FINAL visibility:private superTypes:[<root>.MyEnum]'
init: EXPRESSION_BODY
ENUM_CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.MyEnum'
FUN name:values visibility:public modality:FINAL <> ($this:<root>.MyEnum) returnType:kotlin.Array<<root>.MyEnum>
$this: VALUE_PARAMETER name:<this> type:<root>.MyEnum
BLOCK_BODY
@@ -26,12 +26,8 @@ FILE fqName:<root> fileName:/objectAsCallable.kt
<E>: <root>.En
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_CLASS name:En modality:FINAL visibility:public superTypes:[kotlin.Enum<<root>.En>]'
ENUM_ENTRY name:X
class: CLASS ENUM_ENTRY name:X modality:FINAL visibility:private superTypes:[<root>.En]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.En.X
CONSTRUCTOR visibility:private <> () returnType:<uninitialized parent>.<anonymous> [primary]
BLOCK_BODY
ENUM_CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.En'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_ENTRY name:X modality:FINAL visibility:private superTypes:[<root>.En]'
init: EXPRESSION_BODY
ENUM_CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.En'
FUN name:values visibility:public modality:FINAL <> ($this:<root>.En) returnType:kotlin.Array<<root>.En>
$this: VALUE_PARAMETER name:<this> type:<root>.En
BLOCK_BODY
+2 -6
View File
@@ -7,12 +7,8 @@ FILE fqName:<root> fileName:/values.kt
<E>: <root>.Enum
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_CLASS name:Enum modality:FINAL visibility:public superTypes:[kotlin.Enum<<root>.Enum>]'
ENUM_ENTRY name:A
class: CLASS ENUM_ENTRY name:A modality:FINAL visibility:private superTypes:[<root>.Enum]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Enum.A
CONSTRUCTOR visibility:private <> () returnType:<uninitialized parent>.<anonymous> [primary]
BLOCK_BODY
ENUM_CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.Enum'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_ENTRY name:A modality:FINAL visibility:private superTypes:[<root>.Enum]'
init: EXPRESSION_BODY
ENUM_CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.Enum'
FUN name:values visibility:public modality:FINAL <> ($this:<root>.Enum) returnType:kotlin.Array<<root>.Enum>
$this: VALUE_PARAMETER name:<this> type:<root>.Enum
BLOCK_BODY