[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 *****/ /***** DECLARATIONS *****/
/** /**
* @see org.jetbrains.kotlin.parsing.KotlinParsing.parseClassOrObject * @see org.jetbrains.kotlin.parsing.KotlinParsing.parseClassOrObject
@@ -417,9 +423,12 @@ class DeclarationsConverter(
this.superTypeRefs += superTypeRefs this.superTypeRefs += superTypeRefs
val secondaryConstructors = classBody.getChildNodesByType(SECONDARY_CONSTRUCTOR)
val classWrapper = ClassWrapper( val classWrapper = ClassWrapper(
className, modifiers, classKind, primaryConstructor != null, 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, selfType,
delegatedSuperTypeRef ?: defaultDelegatedSuperTypeRef, superTypeCallEntry delegatedSuperTypeRef ?: defaultDelegatedSuperTypeRef, superTypeCallEntry
) )
@@ -503,6 +512,7 @@ class DeclarationsConverter(
val classWrapper = ClassWrapper( val classWrapper = ClassWrapper(
SpecialNames.NO_NAME_PROVIDED, modifiers, ClassKind.OBJECT, hasPrimaryConstructor = false, SpecialNames.NO_NAME_PROVIDED, modifiers, ClassKind.OBJECT, hasPrimaryConstructor = false,
hasSecondaryConstructor = classBody.getChildNodesByType(SECONDARY_CONSTRUCTOR).isNotEmpty(), hasSecondaryConstructor = classBody.getChildNodesByType(SECONDARY_CONSTRUCTOR).isNotEmpty(),
hasDefaultConstructor = false,
delegatedSelfTypeRef = delegatedType, delegatedSelfTypeRef = delegatedType,
delegatedSuperTypeRef = delegatedType, delegatedSuperTypeRef = delegatedType,
superTypeCallEntry = superTypeCallEntry superTypeCallEntry = superTypeCallEntry
@@ -541,6 +551,15 @@ class DeclarationsConverter(
session = baseSession session = baseSession
returnTypeRef = classWrapper.delegatedSelfTypeRef returnTypeRef = classWrapper.delegatedSelfTypeRef
name = enumEntryName 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) { initializer = withChildClassName(enumEntryName) {
buildAnonymousObject { buildAnonymousObject {
source = this@buildEnumEntry.source source = this@buildEnumEntry.source
@@ -552,6 +571,7 @@ class DeclarationsConverter(
val enumClassWrapper = ClassWrapper( val enumClassWrapper = ClassWrapper(
enumEntryName, modifiers, ClassKind.ENUM_ENTRY, hasPrimaryConstructor = true, enumEntryName, modifiers, ClassKind.ENUM_ENTRY, hasPrimaryConstructor = true,
hasSecondaryConstructor = classBodyNode.getChildNodesByType(SECONDARY_CONSTRUCTOR).isNotEmpty(), hasSecondaryConstructor = classBodyNode.getChildNodesByType(SECONDARY_CONSTRUCTOR).isNotEmpty(),
hasDefaultConstructor = false,
delegatedSelfTypeRef = buildResolvedTypeRef { delegatedSelfTypeRef = buildResolvedTypeRef {
type = ConeClassLikeTypeImpl( type = ConeClassLikeTypeImpl(
this@buildAnonymousObject.symbol.toLookupTag(), this@buildAnonymousObject.symbol.toLookupTag(),
@@ -567,10 +587,6 @@ class DeclarationsConverter(
classBodyNode?.also { declarations += convertClassBody(it, enumClassWrapper) } 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, private val classKind: ClassKind,
val hasPrimaryConstructor: Boolean, val hasPrimaryConstructor: Boolean,
val hasSecondaryConstructor: Boolean, val hasSecondaryConstructor: Boolean,
val hasDefaultConstructor: Boolean,
val delegatedSelfTypeRef: FirTypeRef, val delegatedSelfTypeRef: FirTypeRef,
val delegatedSuperTypeRef: FirTypeRef, val delegatedSuperTypeRef: FirTypeRef,
val superTypeCallEntry: MutableList<FirExpression> val superTypeCallEntry: MutableList<FirExpression>
@@ -154,16 +154,25 @@ class RawFirBuilder(
delegatedSuperType: FirTypeRef?, delegatedSelfType: FirResolvedTypeRef?, owner: KtClassOrObject, hasPrimaryConstructor: Boolean, delegatedSuperType: FirTypeRef?, delegatedSelfType: FirResolvedTypeRef?, owner: KtClassOrObject, hasPrimaryConstructor: Boolean,
): FirDeclaration { ): FirDeclaration {
return when (this) { return when (this) {
is KtSecondaryConstructor -> toFirConstructor( is KtSecondaryConstructor -> {
delegatedSuperType, toFirConstructor(
delegatedSelfType ?: buildErrorTypeRef { delegatedSuperType,
source = this@toFirDeclaration.toFirSourceElement() delegatedSelfType ?: buildErrorTypeRef {
diagnostic = FirSimpleDiagnostic("Constructor in object", DiagnosticKind.ConstructorInObject) source = this@toFirDeclaration.toFirSourceElement()
}, diagnostic = FirSimpleDiagnostic("Constructor in object", DiagnosticKind.ConstructorInObject)
owner, },
hasPrimaryConstructor, owner,
) hasPrimaryConstructor,
is KtEnumEntry -> toFirEnumEntry(delegatedSelfType!!) )
}
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() 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 val ktEnumEntry = this@toFirEnumEntry
return buildEnumEntry { return buildEnumEntry {
source = toFirSourceElement() source = toFirSourceElement()
session = baseSession session = baseSession
returnTypeRef = delegatedEnumSelfTypeRef returnTypeRef = delegatedEnumSelfTypeRef
name = nameAsSafeName 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) { initializer = withChildClassName(nameAsSafeName) {
buildAnonymousObject { buildAnonymousObject {
source = toFirSourceElement() source = toFirSourceElement()
@@ -559,12 +581,6 @@ class RawFirBuilder(
} }
} }
} }
status = FirDeclarationStatusImpl(
Visibilities.PUBLIC, Modality.FINAL,
).apply {
isStatic = true
}
symbol = FirVariableSymbol(callableIdForName(nameAsSafeName))
} }
} }
@@ -31,3 +31,16 @@ enum class Planet(val m: Double, internal val r: Double) {
const val G = 6.67e-11 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>|>() super<R|kotlin/Enum<Order>|>()
} }
public final static enum entry FIRST: R|Order| = object : R|Order| { public final static enum entry FIRST: R|Order|
public? constructor(): R|anonymous| { public final static enum entry SECOND: R|Order|
super<R|Order|>() public final static enum entry THIRD: 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 fun values(): R|kotlin/Array<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
@@ -14,3 +14,24 @@ enum class SomeEnum(val x: Some) {
abstract fun check(y: Some): Boolean 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>|>() super<R|kotlin/Enum<EC>|>()
} }
public final static enum entry A: R|EC| = object : R|EC| { public final static enum entry A: R|EC|
private constructor(): R|anonymous| { public final static enum entry B: R|EC|
super<R|EC|>()
}
}
public final static enum entry B: R|EC| = object : R|EC| {
private constructor(): R|anonymous| {
super<R|EC|>()
}
}
public final companion object Companion : R|kotlin/Any| { public final companion object Companion : R|kotlin/Any| {
private constructor(): R|EC.Companion| { private constructor(): R|EC.Companion| {
super<R|kotlin/Any|>() super<R|kotlin/Any|>()
@@ -4,27 +4,9 @@ FILE: main.kt
super<R|kotlin/Enum<E>|>() super<R|kotlin/Enum<E>|>()
} }
public final static enum entry A: R|E| = object : R|E| { public final static enum entry A: R|E|
private constructor(): R|anonymous| { public final static enum entry B: R|E|
super<R|E|>() public final static enum entry C: 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 fun values(): R|kotlin/Array<E>| { public final static fun values(): R|kotlin/Array<E>| {
} }
@@ -4,27 +4,9 @@ FILE: exhaustiveness_enum.kt
super<R|kotlin/Enum<Enum>|>() super<R|kotlin/Enum<Enum>|>()
} }
public final static enum entry A: R|Enum| = object : R|Enum| { public final static enum entry A: R|Enum|
private constructor(): R|anonymous| { public final static enum entry B: R|Enum|
super<R|Enum|>() public final static enum entry C: 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 fun values(): R|kotlin/Array<Enum>| { public final static fun values(): R|kotlin/Array<Enum>| {
} }
@@ -4,20 +4,8 @@ FILE: enumEntryUse.kt
super<R|kotlin/Enum<TestEnum>|>() super<R|kotlin/Enum<TestEnum>|>()
} }
public final static enum entry FIRST: R|TestEnum| = object : R|TestEnum| { public final static enum entry FIRST: R|TestEnum|
private constructor(): R|anonymous| { public final static enum entry SECOND: R|TestEnum|
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 THIRD: R|TestEnum| = object : R|TestEnum| { public final static enum entry THIRD: R|TestEnum| = object : R|TestEnum| {
private constructor(): R|anonymous| { private constructor(): R|anonymous| {
super<R|TestEnum|>() super<R|TestEnum|>()
@@ -4,27 +4,9 @@ FILE: enumValues.kt
super<R|kotlin/Enum<MyEnum>|>() super<R|kotlin/Enum<MyEnum>|>()
} }
public final static enum entry FIRST: R|MyEnum| = object : R|MyEnum| { public final static enum entry FIRST: R|MyEnum|
private constructor(): R|anonymous| { public final static enum entry SECOND: R|MyEnum|
super<R|MyEnum|>() public final static enum entry LAST: 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 fun bar(): R|kotlin/Int| { public final fun bar(): R|kotlin/Int| {
^bar Int(42) ^bar Int(42)
} }
@@ -33,13 +33,7 @@ FILE: qualifiedExpressions.kt
super<R|kotlin/Enum<a/b/E>|>() super<R|kotlin/Enum<a/b/E>|>()
} }
public final static enum entry entry: R|a/b/E| = object : R|a/b/E| { public final static enum entry entry: R|a/b/E|
private constructor(): R|anonymous| {
super<R|a/b/E|>()
}
}
public final static fun values(): R|kotlin/Array<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>|>() super<R|kotlin/Enum<G>|>()
} }
public final static enum entry H: R|G| = object : R|G| { public final static enum entry H: R|G|
private constructor(): R|anonymous| {
super<R|G|>()
}
}
public final fun foo(): R|kotlin/Unit| { public final fun foo(): R|kotlin/Unit| {
R|/G.values|() R|/G.values|()
} }
+3 -21
View File
@@ -4,27 +4,9 @@ FILE: enums.kt
super<R|kotlin/Enum<Order>|>() super<R|kotlin/Enum<Order>|>()
} }
public final static enum entry FIRST: R|Order| = object : R|Order| { public final static enum entry FIRST: R|Order|
private constructor(): R|anonymous| { public final static enum entry SECOND: R|Order|
super<R|Order|>() public final static enum entry THIRD: 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 fun values(): R|kotlin/Array<Order>| { public final static fun values(): R|kotlin/Array<Order>| {
} }
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
enum class A { enum class A {
ONE, ONE,
TWO; TWO;
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
enum class A { enum class A {
ONE, ONE,
TWO TWO
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
import A.ONE import A.ONE
enum class A { enum class A {
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
import A.ONE import A.ONE
enum class A { enum class A {
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
enum class E { enum class E {
ENTRY; ENTRY;
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// http://youtrack.jetbrains.com/issue/KT-2167 // http://youtrack.jetbrains.com/issue/KT-2167
enum class Season { enum class Season {
-1
View File
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
package test package test
enum class Season { enum class Season {
-1
View File
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
class A { class A {
enum class E { enum class E {
OK OK
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
class A { class A {
companion object {} companion object {}
enum class E { enum class E {
-1
View File
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
enum class Bar { enum class Bar {
ONE, ONE,
TWO TWO
-1
View File
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
enum class Season { enum class Season {
WINTER, WINTER,
SPRING, SPRING,
-1
View File
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// KJS_WITH_FULL_RUNTIME // KJS_WITH_FULL_RUNTIME
// WITH_RUNTIME // WITH_RUNTIME
-1
View File
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
enum class State { enum class State {
O, O,
K K
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
class Outer { class Outer {
enum class Nested { enum class Nested {
O, O,
-1
View File
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
enum class A { X1, X2 } enum class A { X1, X2 }
fun box(): String { fun box(): String {
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// CHECK_CASES_COUNT: function=box count=0 // CHECK_CASES_COUNT: function=box count=0
// CHECK_IF_COUNT: function=box count=1 // CHECK_IF_COUNT: function=box count=1
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// WITH_RUNTIME // WITH_RUNTIME
// CHECK_CASES_COUNT: function=foo count=0 // CHECK_CASES_COUNT: function=foo count=0
// CHECK_IF_COUNT: function=foo count=3 // CHECK_IF_COUNT: function=foo count=3
@@ -1,6 +1,6 @@
enum interface Some { enum interface Some {
// Enum part // Enum part
<!UNRESOLVED_REFERENCE!>D;<!> D;
// Interface like part // Interface like part
fun test() fun test()
+4 -12
View File
@@ -7,19 +7,11 @@ FILE fqName:<root> fileName:/enum.kt
<E>: <root>.TestEnum1 <E>: <root>.TestEnum1
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_CLASS name:TestEnum1 modality:FINAL visibility:public superTypes:[kotlin.Enum<<root>.TestEnum1>]' INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_CLASS name:TestEnum1 modality:FINAL visibility:public superTypes:[kotlin.Enum<<root>.TestEnum1>]'
ENUM_ENTRY name:TEST1 ENUM_ENTRY name:TEST1
class: CLASS ENUM_ENTRY name:TEST1 modality:FINAL visibility:private superTypes:[<root>.TestEnum1] init: EXPRESSION_BODY
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.TestEnum1.TEST1 ENUM_CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.TestEnum1'
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]'
ENUM_ENTRY name:TEST2 ENUM_ENTRY name:TEST2
class: CLASS ENUM_ENTRY name:TEST2 modality:FINAL visibility:private superTypes:[<root>.TestEnum1] init: EXPRESSION_BODY
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.TestEnum1.TEST2 ENUM_CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.TestEnum1'
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]'
FUN name:values visibility:public modality:FINAL <> ($this:<root>.TestEnum1) returnType:kotlin.Array<<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 $this: VALUE_PARAMETER name:<this> type:<root>.TestEnum1
BLOCK_BODY BLOCK_BODY
@@ -7,12 +7,8 @@ FILE fqName:<root> fileName:/enumClassModality.kt
<E>: <root>.TestFinalEnum1 <E>: <root>.TestFinalEnum1
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_CLASS name:TestFinalEnum1 modality:FINAL visibility:public superTypes:[kotlin.Enum<<root>.TestFinalEnum1>]' INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_CLASS name:TestFinalEnum1 modality:FINAL visibility:public superTypes:[kotlin.Enum<<root>.TestFinalEnum1>]'
ENUM_ENTRY name:X1 ENUM_ENTRY name:X1
class: CLASS ENUM_ENTRY name:X1 modality:FINAL visibility:private superTypes:[<root>.TestFinalEnum1] init: EXPRESSION_BODY
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.TestFinalEnum1.X1 ENUM_CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.TestFinalEnum1'
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]'
FUN name:values visibility:public modality:FINAL <> ($this:<root>.TestFinalEnum1) returnType:kotlin.Array<<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 $this: VALUE_PARAMETER name:<this> type:<root>.TestFinalEnum1
BLOCK_BODY BLOCK_BODY
@@ -130,12 +126,8 @@ FILE fqName:<root> fileName:/enumClassModality.kt
<E>: <root>.TestFinalEnum3 <E>: <root>.TestFinalEnum3
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_CLASS name:TestFinalEnum3 modality:FINAL visibility:public superTypes:[kotlin.Enum<<root>.TestFinalEnum3>]' INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_CLASS name:TestFinalEnum3 modality:FINAL visibility:public superTypes:[kotlin.Enum<<root>.TestFinalEnum3>]'
ENUM_ENTRY name:X1 ENUM_ENTRY name:X1
class: CLASS ENUM_ENTRY name:X1 modality:FINAL visibility:private superTypes:[<root>.TestFinalEnum3] init: EXPRESSION_BODY
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.TestFinalEnum3.X1 ENUM_CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.TestFinalEnum3'
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]'
FUN name:doStuff visibility:public modality:FINAL <> ($this:<root>.TestFinalEnum3) returnType:kotlin.Unit FUN name:doStuff visibility:public modality:FINAL <> ($this:<root>.TestFinalEnum3) returnType:kotlin.Unit
$this: VALUE_PARAMETER name:<this> type:<root>.TestFinalEnum3 $this: VALUE_PARAMETER name:<this> type:<root>.TestFinalEnum3
BLOCK_BODY BLOCK_BODY
@@ -7,33 +7,17 @@ FILE fqName:<root> fileName:/enumsInAnnotationArguments.kt
<E>: <root>.En <E>: <root>.En
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_CLASS name:En modality:FINAL visibility:public superTypes:[kotlin.Enum<<root>.En>]' INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_CLASS name:En modality:FINAL visibility:public superTypes:[kotlin.Enum<<root>.En>]'
ENUM_ENTRY name:A ENUM_ENTRY name:A
class: CLASS ENUM_ENTRY name:A modality:FINAL visibility:private superTypes:[<root>.En] init: EXPRESSION_BODY
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.En.A ENUM_CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.En'
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]'
ENUM_ENTRY name:B ENUM_ENTRY name:B
class: CLASS ENUM_ENTRY name:B modality:FINAL visibility:private superTypes:[<root>.En] init: EXPRESSION_BODY
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.En.B ENUM_CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.En'
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]'
ENUM_ENTRY name:C ENUM_ENTRY name:C
class: CLASS ENUM_ENTRY name:C modality:FINAL visibility:private superTypes:[<root>.En] init: EXPRESSION_BODY
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.En.C ENUM_CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.En'
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]'
ENUM_ENTRY name:D ENUM_ENTRY name:D
class: CLASS ENUM_ENTRY name:D modality:FINAL visibility:private superTypes:[<root>.En] init: EXPRESSION_BODY
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.En.D ENUM_CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.En'
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]'
FUN name:values visibility:public modality:FINAL <> ($this:<root>.En) returnType:kotlin.Array<<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 $this: VALUE_PARAMETER name:<this> type:<root>.En
BLOCK_BODY BLOCK_BODY
@@ -7,19 +7,11 @@ FILE fqName:<root> fileName:/expectedEnumClass.kt
<E>: <root>.MyEnum <E>: <root>.MyEnum
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_CLASS name:MyEnum modality:FINAL visibility:public [expect] superTypes:[kotlin.Enum<<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 ENUM_ENTRY name:FOO
class: CLASS ENUM_ENTRY name:FOO modality:FINAL visibility:private superTypes:[<root>.MyEnum] init: EXPRESSION_BODY
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.MyEnum.FOO ENUM_CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.MyEnum'
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]'
ENUM_ENTRY name:BAR ENUM_ENTRY name:BAR
class: CLASS ENUM_ENTRY name:BAR modality:FINAL visibility:private superTypes:[<root>.MyEnum] init: EXPRESSION_BODY
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.MyEnum.BAR ENUM_CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.MyEnum'
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]'
FUN name:values visibility:public modality:FINAL <> ($this:<root>.MyEnum) returnType:kotlin.Array<<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 $this: VALUE_PARAMETER name:<this> type:<root>.MyEnum
BLOCK_BODY BLOCK_BODY
@@ -69,26 +61,14 @@ FILE fqName:<root> fileName:/expectedEnumClass.kt
<E>: <root>.MyEnum <E>: <root>.MyEnum
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_CLASS name:MyEnum modality:FINAL visibility:public superTypes:[kotlin.Enum<<root>.MyEnum>]' INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_CLASS name:MyEnum modality:FINAL visibility:public superTypes:[kotlin.Enum<<root>.MyEnum>]'
ENUM_ENTRY name:FOO ENUM_ENTRY name:FOO
class: CLASS ENUM_ENTRY name:FOO modality:FINAL visibility:private superTypes:[<root>.MyEnum] init: EXPRESSION_BODY
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.MyEnum.FOO ENUM_CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.MyEnum'
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]'
ENUM_ENTRY name:BAR ENUM_ENTRY name:BAR
class: CLASS ENUM_ENTRY name:BAR modality:FINAL visibility:private superTypes:[<root>.MyEnum] init: EXPRESSION_BODY
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.MyEnum.BAR ENUM_CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.MyEnum'
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]'
ENUM_ENTRY name:BAZ ENUM_ENTRY name:BAZ
class: CLASS ENUM_ENTRY name:BAZ modality:FINAL visibility:private superTypes:[<root>.MyEnum] init: EXPRESSION_BODY
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.MyEnum.BAZ ENUM_CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.MyEnum'
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]'
FUN name:values visibility:public modality:FINAL <> ($this:<root>.MyEnum) returnType:kotlin.Array<<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 $this: VALUE_PARAMETER name:<this> type:<root>.MyEnum
BLOCK_BODY BLOCK_BODY
@@ -26,12 +26,8 @@ FILE fqName:<root> fileName:/objectAsCallable.kt
<E>: <root>.En <E>: <root>.En
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_CLASS name:En modality:FINAL visibility:public superTypes:[kotlin.Enum<<root>.En>]' INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_CLASS name:En modality:FINAL visibility:public superTypes:[kotlin.Enum<<root>.En>]'
ENUM_ENTRY name:X ENUM_ENTRY name:X
class: CLASS ENUM_ENTRY name:X modality:FINAL visibility:private superTypes:[<root>.En] init: EXPRESSION_BODY
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.En.X ENUM_CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.En'
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]'
FUN name:values visibility:public modality:FINAL <> ($this:<root>.En) returnType:kotlin.Array<<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 $this: VALUE_PARAMETER name:<this> type:<root>.En
BLOCK_BODY BLOCK_BODY
+2 -6
View File
@@ -7,12 +7,8 @@ FILE fqName:<root> fileName:/values.kt
<E>: <root>.Enum <E>: <root>.Enum
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_CLASS name:Enum modality:FINAL visibility:public superTypes:[kotlin.Enum<<root>.Enum>]' INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_CLASS name:Enum modality:FINAL visibility:public superTypes:[kotlin.Enum<<root>.Enum>]'
ENUM_ENTRY name:A ENUM_ENTRY name:A
class: CLASS ENUM_ENTRY name:A modality:FINAL visibility:private superTypes:[<root>.Enum] init: EXPRESSION_BODY
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Enum.A ENUM_CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.Enum'
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]'
FUN name:values visibility:public modality:FINAL <> ($this:<root>.Enum) returnType:kotlin.Array<<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 $this: VALUE_PARAMETER name:<this> type:<root>.Enum
BLOCK_BODY BLOCK_BODY