From 27998ddc8233e71c464b93125e5419ae9419b8cf Mon Sep 17 00:00:00 2001 From: Youssef Shoaib Date: Mon, 10 Apr 2023 14:28:52 +0100 Subject: [PATCH] Replace equality checks on sealed objects with `is` checks (fixes #129) --- README.md | 36 +- .../common/spec/SealedEnumTypeSpec.kt | 6 +- .../compilation/basic/OneObjectSealedClass.kt | 6 +- .../basic/OneObjectSealedInterface.kt | 6 +- .../compilation/basic/TwoObjectSealedClass.kt | 12 +- .../basic/TwoObjectSealedInterface.kt | 12 +- .../sealedenum/compilation/equality/Flag.kt | 120 +++++++ .../compilation/equality/FlagTests.kt | 50 +++ .../generics/GenericSealedClass.kt | 49 +-- .../generics/SealedEnumWithInterfaces.kt | 25 +- .../hierarchy/SealedClassHierarchy.kt | 68 ++-- .../hierarchy/SealedInterfaceHierarchy.kt | 69 ++-- .../compilation/location/NestedClass.kt | 16 +- .../location/OutsideSealedClass.kt | 66 ++-- .../location/SplitAcrossFilesSealedClass.kt | 18 +- .../compilation/traversal/TraversalOrder.kt | 336 +++++++++--------- .../usecases/EnvironmentsSealedEnum.kt | 24 +- .../visibility/PrivateInterfaceSealedClass.kt | 12 +- .../ProtectedInterfaceSealedClass.kt | 12 +- ...ealedClassWithDifferentPackageBaseClass.kt | 18 +- .../visibility/VisibilitySealedClass.kt | 56 +-- .../kitchensink/JavaBaseClasses.kt | 12 +- .../com/livefront/sealedenum/GenSealedEnum.kt | 32 +- 23 files changed, 621 insertions(+), 440 deletions(-) create mode 100644 processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/equality/Flag.kt create mode 100644 processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/equality/FlagTests.kt diff --git a/README.md b/README.md index 1872fce8..24299c79 100644 --- a/README.md +++ b/README.md @@ -94,13 +94,13 @@ object AlphaSealedEnum : SealedEnum { ) override fun ordinalOf(obj: Alpha): Int = when (obj) { - Alpha.Beta -> 0 - Alpha.Gamma -> 1 + is Alpha.Beta -> 0 + is Alpha.Gamma -> 1 } override fun nameOf(obj: AlphaSealedEnum): String = when (obj) { - Alpha.Beta -> "Alpha_Beta" - Alpha.Gamma -> "Alpha_Gamma" + is Alpha.Beta -> "Alpha_Beta" + is Alpha.Gamma -> "Alpha_Gamma" } override fun valueOf(name: String): AlphaSealedEnum = when (name) { @@ -157,15 +157,15 @@ object AlphaLevelOrderSealedEnum : SealedEnum { ) override fun ordinalOf(obj: Alpha): Int = when (obj) { - Alpha.Delta -> 0 - Alpha.Beta.Gamma -> 1 - Alpha.Epsilon.Zeta -> 2 + is Alpha.Delta -> 0 + is Alpha.Beta.Gamma -> 1 + is Alpha.Epsilon.Zeta -> 2 } override fun nameOf(obj: AlphaLevelOrderSealedEnum): String = when (obj) { - Alpha.Delta -> "Alpha_Delta" - Alpha.Beta.Gamma -> "Alpha_Beta_Gamma" - Alpha.Epsilon.Zeta -> "Alpha_Epsilon_Zeta" + is Alpha.Delta -> "Alpha_Delta" + is Alpha.Beta.Gamma -> "Alpha_Beta_Gamma" + is Alpha.Epsilon.Zeta -> "Alpha_Epsilon_Zeta" } override fun valueOf(name: String): AlphaLevelOrderSealedEnum = when (name) { @@ -184,15 +184,15 @@ object AlphaInOrderSealedEnum : SealedEnum { ) override fun ordinalOf(obj: Alpha): Int = when (obj) { - Alpha.Beta.Gamma -> 0 - Alpha.Delta -> 1 - Alpha.Epsilon.Zeta -> 2 + is Alpha.Beta.Gamma -> 0 + is Alpha.Delta -> 1 + is Alpha.Epsilon.Zeta -> 2 } override fun nameOf(obj: AlphaInOrderSealedEnum): String = when (obj) { - Alpha.Beta.Gamma -> "Alpha_Beta_Gamma" - Alpha.Delta -> "Alpha_Delta" - Alpha.Epsilon.Zeta -> "Alpha_Epsilon_Zeta" + is Alpha.Beta.Gamma -> "Alpha_Beta_Gamma" + is Alpha.Delta -> "Alpha_Delta" + is Alpha.Epsilon.Zeta -> "Alpha_Epsilon_Zeta" } override fun valueOf(name: String): AlphaInOrderSealedEnum = when (name) { @@ -293,8 +293,8 @@ object AlphaSealedEnum : SealedEnum, SealedEnumWithEnumProvider AlphaEnum.Alpha_Beta - Alpha.Gamma -> AlphaEnum.Alpha_Gamma + is Alpha.Beta -> AlphaEnum.Alpha_Beta + is Alpha.Gamma -> AlphaEnum.Alpha_Gamma } override fun enumToSealedObject(enum: AlphaEnum): Alpha = when (enum) { diff --git a/processing-common/src/main/kotlin/com/livefront/sealedenum/internal/common/spec/SealedEnumTypeSpec.kt b/processing-common/src/main/kotlin/com/livefront/sealedenum/internal/common/spec/SealedEnumTypeSpec.kt index e57d6b29..ec7894fe 100644 --- a/processing-common/src/main/kotlin/com/livefront/sealedenum/internal/common/spec/SealedEnumTypeSpec.kt +++ b/processing-common/src/main/kotlin/com/livefront/sealedenum/internal/common/spec/SealedEnumTypeSpec.kt @@ -108,7 +108,7 @@ internal data class SealedEnumTypeSpec( } else { beginControlFlow("return when (obj)") sealedObjects.forEachIndexed { index, obj -> - addStatement("%T -> $index", obj) + addStatement("is %T -> $index", obj) } endControlFlow() } @@ -131,7 +131,7 @@ internal data class SealedEnumTypeSpec( } else { beginControlFlow("return when (obj)") sealedObjects.forEach { obj -> - addStatement("%T -> %S", obj, sealedObjectToName(obj)) + addStatement("is %T -> %S", obj, sealedObjectToName(obj)) } endControlFlow() } @@ -177,7 +177,7 @@ internal data class SealedEnumTypeSpec( beginControlFlow("return when (obj)") sealedObjects.forEach { obj -> addStatement( - "%T -> %T", + "is %T -> %T", obj, enumForSealedEnum.nestedClass(obj.simpleNames.joinToString("_")) ) diff --git a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/basic/OneObjectSealedClass.kt b/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/basic/OneObjectSealedClass.kt index 19dcb133..15040116 100644 --- a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/basic/OneObjectSealedClass.kt +++ b/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/basic/OneObjectSealedClass.kt @@ -56,11 +56,11 @@ public object OneObjectSealedClassSealedEnum : SealedEnum, get() = OneObjectSealedClassEnum::class public override fun ordinalOf(obj: OneObjectSealedClass): Int = when (obj) { - OneObjectSealedClass.FirstObject -> 0 + is OneObjectSealedClass.FirstObject -> 0 } public override fun nameOf(obj: OneObjectSealedClass): String = when (obj) { - OneObjectSealedClass.FirstObject -> "OneObjectSealedClass_FirstObject" + is OneObjectSealedClass.FirstObject -> "OneObjectSealedClass_FirstObject" } public override fun valueOf(name: String): OneObjectSealedClass = when (name) { @@ -70,7 +70,7 @@ public object OneObjectSealedClassSealedEnum : SealedEnum, public override fun sealedObjectToEnum(obj: OneObjectSealedClass): OneObjectSealedClassEnum = when (obj) { - OneObjectSealedClass.FirstObject -> + is OneObjectSealedClass.FirstObject -> OneObjectSealedClassEnum.OneObjectSealedClass_FirstObject } diff --git a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/basic/OneObjectSealedInterface.kt b/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/basic/OneObjectSealedInterface.kt index 1c4e4a9d..4fbbddc3 100644 --- a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/basic/OneObjectSealedInterface.kt +++ b/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/basic/OneObjectSealedInterface.kt @@ -56,11 +56,11 @@ public object OneObjectSealedInterfaceSealedEnum : SealedEnum 0 + is OneObjectSealedInterface.FirstObject -> 0 } public override fun nameOf(obj: OneObjectSealedInterface): String = when (obj) { - OneObjectSealedInterface.FirstObject -> "OneObjectSealedInterface_FirstObject" + is OneObjectSealedInterface.FirstObject -> "OneObjectSealedInterface_FirstObject" } public override fun valueOf(name: String): OneObjectSealedInterface = when (name) { @@ -70,7 +70,7 @@ public object OneObjectSealedInterfaceSealedEnum : SealedEnum + is OneObjectSealedInterface.FirstObject -> OneObjectSealedInterfaceEnum.OneObjectSealedInterface_FirstObject } diff --git a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/basic/TwoObjectSealedClass.kt b/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/basic/TwoObjectSealedClass.kt index 977eff70..882786f1 100644 --- a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/basic/TwoObjectSealedClass.kt +++ b/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/basic/TwoObjectSealedClass.kt @@ -60,13 +60,13 @@ public object TwoObjectSealedClassSealedEnum : SealedEnum, get() = TwoObjectSealedClassEnum::class public override fun ordinalOf(obj: TwoObjectSealedClass): Int = when (obj) { - TwoObjectSealedClass.FirstObject -> 0 - TwoObjectSealedClass.SecondObject -> 1 + is TwoObjectSealedClass.FirstObject -> 0 + is TwoObjectSealedClass.SecondObject -> 1 } public override fun nameOf(obj: TwoObjectSealedClass): String = when (obj) { - TwoObjectSealedClass.FirstObject -> "TwoObjectSealedClass_FirstObject" - TwoObjectSealedClass.SecondObject -> "TwoObjectSealedClass_SecondObject" + is TwoObjectSealedClass.FirstObject -> "TwoObjectSealedClass_FirstObject" + is TwoObjectSealedClass.SecondObject -> "TwoObjectSealedClass_SecondObject" } public override fun valueOf(name: String): TwoObjectSealedClass = when (name) { @@ -77,9 +77,9 @@ public object TwoObjectSealedClassSealedEnum : SealedEnum, public override fun sealedObjectToEnum(obj: TwoObjectSealedClass): TwoObjectSealedClassEnum = when (obj) { - TwoObjectSealedClass.FirstObject -> + is TwoObjectSealedClass.FirstObject -> TwoObjectSealedClassEnum.TwoObjectSealedClass_FirstObject - TwoObjectSealedClass.SecondObject -> + is TwoObjectSealedClass.SecondObject -> TwoObjectSealedClassEnum.TwoObjectSealedClass_SecondObject } diff --git a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/basic/TwoObjectSealedInterface.kt b/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/basic/TwoObjectSealedInterface.kt index ba9bb866..2b118d7b 100644 --- a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/basic/TwoObjectSealedInterface.kt +++ b/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/basic/TwoObjectSealedInterface.kt @@ -60,13 +60,13 @@ public object TwoObjectSealedInterfaceSealedEnum : SealedEnum 0 - TwoObjectSealedInterface.SecondObject -> 1 + is TwoObjectSealedInterface.FirstObject -> 0 + is TwoObjectSealedInterface.SecondObject -> 1 } public override fun nameOf(obj: TwoObjectSealedInterface): String = when (obj) { - TwoObjectSealedInterface.FirstObject -> "TwoObjectSealedInterface_FirstObject" - TwoObjectSealedInterface.SecondObject -> "TwoObjectSealedInterface_SecondObject" + is TwoObjectSealedInterface.FirstObject -> "TwoObjectSealedInterface_FirstObject" + is TwoObjectSealedInterface.SecondObject -> "TwoObjectSealedInterface_SecondObject" } public override fun valueOf(name: String): TwoObjectSealedInterface = when (name) { @@ -77,9 +77,9 @@ public object TwoObjectSealedInterfaceSealedEnum : SealedEnum + is TwoObjectSealedInterface.FirstObject -> TwoObjectSealedInterfaceEnum.TwoObjectSealedInterface_FirstObject - TwoObjectSealedInterface.SecondObject -> + is TwoObjectSealedInterface.SecondObject -> TwoObjectSealedInterfaceEnum.TwoObjectSealedInterface_SecondObject } diff --git a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/equality/Flag.kt b/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/equality/Flag.kt new file mode 100644 index 00000000..ef7fc830 --- /dev/null +++ b/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/equality/Flag.kt @@ -0,0 +1,120 @@ +package com.livefront.sealedenum.compilation.equality + +import com.livefront.sealedenum.GenSealedEnum +import org.intellij.lang.annotations.Language + +sealed class Flag { + val i: Int = 1 shl ordinal + object FirstFlag : Flag() + + object SecondFlag : Flag() + + @GenSealedEnum(generateEnum = true) + companion object +} + +@Language("kotlin") +val flagGenerated = """ +package com.livefront.sealedenum.compilation.equality + +import com.livefront.sealedenum.EnumForSealedEnumProvider +import com.livefront.sealedenum.SealedEnum +import com.livefront.sealedenum.SealedEnumWithEnumProvider +import kotlin.Int +import kotlin.String +import kotlin.collections.List +import kotlin.reflect.KClass + +/** + * An isomorphic enum for the sealed class [Flag] + */ +public enum class FlagEnum() { + Flag_FirstFlag, + Flag_SecondFlag, +} + +/** + * The isomorphic [FlagEnum] for [this]. + */ +public val Flag.`enum`: FlagEnum + get() = FlagSealedEnum.sealedObjectToEnum(this) + +/** + * The isomorphic [Flag] for [this]. + */ +public val FlagEnum.sealedObject: Flag + get() = FlagSealedEnum.enumToSealedObject(this) + +/** + * An implementation of [SealedEnum] for the sealed class [Flag] + */ +public object FlagSealedEnum : SealedEnum, SealedEnumWithEnumProvider, + EnumForSealedEnumProvider { + public override val values: List = listOf( + Flag.FirstFlag, + Flag.SecondFlag + ) + + + public override val enumClass: KClass + get() = FlagEnum::class + + public override fun ordinalOf(obj: Flag): Int = when (obj) { + is Flag.FirstFlag -> 0 + is Flag.SecondFlag -> 1 + } + + public override fun nameOf(obj: Flag): String = when (obj) { + is Flag.FirstFlag -> "Flag_FirstFlag" + is Flag.SecondFlag -> "Flag_SecondFlag" + } + + public override fun valueOf(name: String): Flag = when (name) { + "Flag_FirstFlag" -> Flag.FirstFlag + "Flag_SecondFlag" -> Flag.SecondFlag + else -> throw IllegalArgumentException(""${'"'}No sealed enum constant ${'$'}name""${'"'}) + } + + public override fun sealedObjectToEnum(obj: Flag): FlagEnum = when (obj) { + is Flag.FirstFlag -> FlagEnum.Flag_FirstFlag + is Flag.SecondFlag -> FlagEnum.Flag_SecondFlag + } + + public override fun enumToSealedObject(`enum`: FlagEnum): Flag = when (enum) { + FlagEnum.Flag_FirstFlag -> Flag.FirstFlag + FlagEnum.Flag_SecondFlag -> Flag.SecondFlag + } +} + +/** + * The index of [this] in the values list. + */ +public val Flag.ordinal: Int + get() = FlagSealedEnum.ordinalOf(this) + +/** + * The name of [this] for use with valueOf. + */ +public val Flag.name: String + get() = FlagSealedEnum.nameOf(this) + +/** + * A list of all [Flag] objects. + */ +public val Flag.Companion.values: List + get() = FlagSealedEnum.values + +/** + * Returns an implementation of [SealedEnum] for the sealed class [Flag] + */ +public val Flag.Companion.sealedEnum: FlagSealedEnum + get() = FlagSealedEnum + +/** + * Returns the [Flag] object for the given [name]. + * + * If the given name doesn't correspond to any [Flag], an [IllegalArgumentException] will be thrown. + */ +public fun Flag.Companion.valueOf(name: String): Flag = FlagSealedEnum.valueOf(name) + +""".trimIndent() diff --git a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/equality/FlagTests.kt b/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/equality/FlagTests.kt new file mode 100644 index 00000000..74c16138 --- /dev/null +++ b/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/equality/FlagTests.kt @@ -0,0 +1,50 @@ +package com.livefront.sealedenum.compilation.equality + +import com.livefront.sealedenum.testing.assertCompiles +import com.livefront.sealedenum.testing.assertGeneratedFileMatches +import com.livefront.sealedenum.testing.compile +import com.livefront.sealedenum.testing.getCommonSourceFile +import org.junit.jupiter.api.Assertions.assertEquals +import org.junit.jupiter.api.Test + +class FlagTests { + @Test + fun `two objects sealed class`() { + assertEquals( + listOf(Flag.FirstFlag, Flag.SecondFlag), + FlagSealedEnum.values + ) + } + + @Test + fun `two enums for sealed class`() { + assertEquals( + listOf( + FlagEnum.Flag_FirstFlag, + FlagEnum.Flag_SecondFlag + ), + enumValues().toList() + ) + } + + @Test + fun `two enums for sealed class with mapping`() { + assertEquals( + Flag.values.map(Flag::enum), + enumValues().toList() + ) + } + + @Test + fun `correct enum class`() { + assertEquals(FlagEnum::class, FlagSealedEnum.enumClass) + } + + @Test + fun `compilation generates correct code`() { + val result = compile(getCommonSourceFile("compilation", "equality", "Flag.kt")) + + assertCompiles(result) + assertGeneratedFileMatches("Flag_SealedEnum.kt", flagGenerated, result) + } +} diff --git a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/generics/GenericSealedClass.kt b/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/generics/GenericSealedClass.kt index 4c31e4e1..fb5860d8 100644 --- a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/generics/GenericSealedClass.kt +++ b/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/generics/GenericSealedClass.kt @@ -66,15 +66,15 @@ public object OneTypeParameterSealedClassSealedEnum : SealedEnum): Int = when (obj) { - OneTypeParameterSealedClass.FirstObject -> 0 - OneTypeParameterSealedClass.SecondObject -> 1 - OneTypeParameterSealedClass.ThirdObject -> 2 + is OneTypeParameterSealedClass.FirstObject -> 0 + is OneTypeParameterSealedClass.SecondObject -> 1 + is OneTypeParameterSealedClass.ThirdObject -> 2 } public override fun nameOf(obj: OneTypeParameterSealedClass<*>): String = when (obj) { - OneTypeParameterSealedClass.FirstObject -> "OneTypeParameterSealedClass_FirstObject" - OneTypeParameterSealedClass.SecondObject -> "OneTypeParameterSealedClass_SecondObject" - OneTypeParameterSealedClass.ThirdObject -> "OneTypeParameterSealedClass_ThirdObject" + is OneTypeParameterSealedClass.FirstObject -> "OneTypeParameterSealedClass_FirstObject" + is OneTypeParameterSealedClass.SecondObject -> "OneTypeParameterSealedClass_SecondObject" + is OneTypeParameterSealedClass.ThirdObject -> "OneTypeParameterSealedClass_ThirdObject" } public override fun valueOf(name: String): OneTypeParameterSealedClass<*> = when (name) { @@ -86,11 +86,11 @@ public object OneTypeParameterSealedClassSealedEnum : SealedEnum): OneTypeParameterSealedClassEnum = when (obj) { - OneTypeParameterSealedClass.FirstObject -> + is OneTypeParameterSealedClass.FirstObject -> OneTypeParameterSealedClassEnum.OneTypeParameterSealedClass_FirstObject - OneTypeParameterSealedClass.SecondObject -> + is OneTypeParameterSealedClass.SecondObject -> OneTypeParameterSealedClassEnum.OneTypeParameterSealedClass_SecondObject - OneTypeParameterSealedClass.ThirdObject -> + is OneTypeParameterSealedClass.ThirdObject -> OneTypeParameterSealedClassEnum.OneTypeParameterSealedClass_ThirdObject } @@ -200,13 +200,13 @@ public object TwoTypeParameterSealedClassSealedEnum : SealedEnum): Int = when (obj) { - TwoTypeParameterSealedClass.FirstObject -> 0 - TwoTypeParameterSealedClass.SecondObject -> 1 + is TwoTypeParameterSealedClass.FirstObject -> 0 + is TwoTypeParameterSealedClass.SecondObject -> 1 } public override fun nameOf(obj: TwoTypeParameterSealedClass<*, *>): String = when (obj) { - TwoTypeParameterSealedClass.FirstObject -> "TwoTypeParameterSealedClass_FirstObject" - TwoTypeParameterSealedClass.SecondObject -> "TwoTypeParameterSealedClass_SecondObject" + is TwoTypeParameterSealedClass.FirstObject -> "TwoTypeParameterSealedClass_FirstObject" + is TwoTypeParameterSealedClass.SecondObject -> "TwoTypeParameterSealedClass_SecondObject" } public override fun valueOf(name: String): TwoTypeParameterSealedClass<*, *> = when (name) { @@ -217,9 +217,9 @@ public object TwoTypeParameterSealedClassSealedEnum : SealedEnum): TwoTypeParameterSealedClassEnum = when (obj) { - TwoTypeParameterSealedClass.FirstObject -> + is TwoTypeParameterSealedClass.FirstObject -> TwoTypeParameterSealedClassEnum.TwoTypeParameterSealedClass_FirstObject - TwoTypeParameterSealedClass.SecondObject -> + is TwoTypeParameterSealedClass.SecondObject -> TwoTypeParameterSealedClassEnum.TwoTypeParameterSealedClass_SecondObject } @@ -328,13 +328,14 @@ public object LimitedTypeParameterSealedClassSealedEnum : get() = LimitedTypeParameterSealedClassEnum::class public override fun ordinalOf(obj: LimitedTypeParameterSealedClass<*, *>): Int = when (obj) { - LimitedTypeParameterSealedClass.FirstObject -> 0 - LimitedTypeParameterSealedClass.SecondObject -> 1 + is LimitedTypeParameterSealedClass.FirstObject -> 0 + is LimitedTypeParameterSealedClass.SecondObject -> 1 } public override fun nameOf(obj: LimitedTypeParameterSealedClass<*, *>): String = when (obj) { - LimitedTypeParameterSealedClass.FirstObject -> "LimitedTypeParameterSealedClass_FirstObject" - LimitedTypeParameterSealedClass.SecondObject -> + is LimitedTypeParameterSealedClass.FirstObject -> + "LimitedTypeParameterSealedClass_FirstObject" + is LimitedTypeParameterSealedClass.SecondObject -> "LimitedTypeParameterSealedClass_SecondObject" } @@ -347,9 +348,9 @@ public object LimitedTypeParameterSealedClassSealedEnum : public override fun sealedObjectToEnum(obj: LimitedTypeParameterSealedClass<*, *>): LimitedTypeParameterSealedClassEnum = when (obj) { - LimitedTypeParameterSealedClass.FirstObject -> + is LimitedTypeParameterSealedClass.FirstObject -> LimitedTypeParameterSealedClassEnum.LimitedTypeParameterSealedClass_FirstObject - LimitedTypeParameterSealedClass.SecondObject -> + is LimitedTypeParameterSealedClass.SecondObject -> LimitedTypeParameterSealedClassEnum.LimitedTypeParameterSealedClass_SecondObject } @@ -459,11 +460,11 @@ public object MultipleBoundsSealedClassSealedEnum : SealedEnum): Int = when (obj) { - MultipleBoundsSealedClass.FirstObject -> 0 + is MultipleBoundsSealedClass.FirstObject -> 0 } public override fun nameOf(obj: MultipleBoundsSealedClass<*>): String = when (obj) { - MultipleBoundsSealedClass.FirstObject -> "MultipleBoundsSealedClass_FirstObject" + is MultipleBoundsSealedClass.FirstObject -> "MultipleBoundsSealedClass_FirstObject" } public override fun valueOf(name: String): MultipleBoundsSealedClass<*> = when (name) { @@ -473,7 +474,7 @@ public object MultipleBoundsSealedClassSealedEnum : SealedEnum): MultipleBoundsSealedClassEnum = when (obj) { - MultipleBoundsSealedClass.FirstObject -> + is MultipleBoundsSealedClass.FirstObject -> MultipleBoundsSealedClassEnum.MultipleBoundsSealedClass_FirstObject } diff --git a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/generics/SealedEnumWithInterfaces.kt b/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/generics/SealedEnumWithInterfaces.kt index 30002f7b..5c72b95b 100644 --- a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/generics/SealedEnumWithInterfaces.kt +++ b/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/generics/SealedEnumWithInterfaces.kt @@ -171,11 +171,11 @@ public object OneObjectSealedClassWithInterfaceSealedEnum : get() = OneObjectSealedClassWithInterfaceEnum::class public override fun ordinalOf(obj: OneObjectSealedClassWithInterface): Int = when (obj) { - OneObjectSealedClassWithInterface.FirstObject -> 0 + is OneObjectSealedClassWithInterface.FirstObject -> 0 } public override fun nameOf(obj: OneObjectSealedClassWithInterface): String = when (obj) { - OneObjectSealedClassWithInterface.FirstObject -> + is OneObjectSealedClassWithInterface.FirstObject -> "OneObjectSealedClassWithInterface_FirstObject" } @@ -187,7 +187,7 @@ public object OneObjectSealedClassWithInterfaceSealedEnum : public override fun sealedObjectToEnum(obj: OneObjectSealedClassWithInterface): OneObjectSealedClassWithInterfaceEnum = when (obj) { - OneObjectSealedClassWithInterface.FirstObject -> + is OneObjectSealedClassWithInterface.FirstObject -> OneObjectSealedClassWithInterfaceEnum.OneObjectSealedClassWithInterface_FirstObject } @@ -301,15 +301,15 @@ public object TwoObjectSealedClassWithGenericInterfaceSealedEnum : public override fun ordinalOf(obj: TwoObjectSealedClassWithGenericInterface): Int = when (obj) { - TwoObjectSealedClassWithGenericInterface.FirstObject -> 0 - TwoObjectSealedClassWithGenericInterface.SecondObject -> 1 + is TwoObjectSealedClassWithGenericInterface.FirstObject -> 0 + is TwoObjectSealedClassWithGenericInterface.SecondObject -> 1 } public override fun nameOf(obj: TwoObjectSealedClassWithGenericInterface): String = when (obj) { - TwoObjectSealedClassWithGenericInterface.FirstObject -> + is TwoObjectSealedClassWithGenericInterface.FirstObject -> "TwoObjectSealedClassWithGenericInterface_FirstObject" - TwoObjectSealedClassWithGenericInterface.SecondObject -> + is TwoObjectSealedClassWithGenericInterface.SecondObject -> "TwoObjectSealedClassWithGenericInterface_SecondObject" } @@ -325,9 +325,9 @@ public object TwoObjectSealedClassWithGenericInterfaceSealedEnum : public override fun sealedObjectToEnum(obj: TwoObjectSealedClassWithGenericInterface): TwoObjectSealedClassWithGenericInterfaceEnum = when (obj) { - TwoObjectSealedClassWithGenericInterface.FirstObject -> + is TwoObjectSealedClassWithGenericInterface.FirstObject -> TwoObjectSealedClassWithGenericInterfaceEnum.TwoObjectSealedClassWithGenericInterface_FirstObject - TwoObjectSealedClassWithGenericInterface.SecondObject -> + is TwoObjectSealedClassWithGenericInterface.SecondObject -> TwoObjectSealedClassWithGenericInterfaceEnum.TwoObjectSealedClassWithGenericInterface_SecondObject } @@ -442,11 +442,12 @@ public object SealedClassWithGetterInterfaceSealedEnum : SealedEnum 0 + is SealedClassWithGetterInterface.FirstObject -> 0 } public override fun nameOf(obj: SealedClassWithGetterInterface): String = when (obj) { - SealedClassWithGetterInterface.FirstObject -> "SealedClassWithGetterInterface_FirstObject" + is SealedClassWithGetterInterface.FirstObject -> + "SealedClassWithGetterInterface_FirstObject" } public override fun valueOf(name: String): SealedClassWithGetterInterface = when (name) { @@ -456,7 +457,7 @@ public object SealedClassWithGetterInterfaceSealedEnum : SealedEnum + is SealedClassWithGetterInterface.FirstObject -> SealedClassWithGetterInterfaceEnum.SealedClassWithGetterInterface_FirstObject } diff --git a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/hierarchy/SealedClassHierarchy.kt b/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/hierarchy/SealedClassHierarchy.kt index a3f86ab7..2e6ab582 100644 --- a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/hierarchy/SealedClassHierarchy.kt +++ b/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/hierarchy/SealedClassHierarchy.kt @@ -65,11 +65,11 @@ public object FirstClassHierarchy_ASealedEnum : SealedEnum 0 + is FirstClassHierarchy.A.B.C -> 0 } public override fun nameOf(obj: FirstClassHierarchy.A): String = when (obj) { - FirstClassHierarchy.A.B.C -> "FirstClassHierarchy_A_B_C" + is FirstClassHierarchy.A.B.C -> "FirstClassHierarchy_A_B_C" } public override fun valueOf(name: String): FirstClassHierarchy.A = when (name) { @@ -79,7 +79,7 @@ public object FirstClassHierarchy_ASealedEnum : SealedEnum FirstClassHierarchy_AEnum.FirstClassHierarchy_A_B_C + is FirstClassHierarchy.A.B.C -> FirstClassHierarchy_AEnum.FirstClassHierarchy_A_B_C } public override fun enumToSealedObject(`enum`: FirstClassHierarchy_AEnum): FirstClassHierarchy.A @@ -169,11 +169,11 @@ public object FirstClassHierarchy_A_BSealedEnum : SealedEnum 0 + is FirstClassHierarchy.A.B.C -> 0 } public override fun nameOf(obj: FirstClassHierarchy.A.B): String = when (obj) { - FirstClassHierarchy.A.B.C -> "FirstClassHierarchy_A_B_C" + is FirstClassHierarchy.A.B.C -> "FirstClassHierarchy_A_B_C" } public override fun valueOf(name: String): FirstClassHierarchy.A.B = when (name) { @@ -183,7 +183,7 @@ public object FirstClassHierarchy_A_BSealedEnum : SealedEnum FirstClassHierarchy_A_BEnum.FirstClassHierarchy_A_B_C + is FirstClassHierarchy.A.B.C -> FirstClassHierarchy_A_BEnum.FirstClassHierarchy_A_B_C } public override fun enumToSealedObject(`enum`: FirstClassHierarchy_A_BEnum): @@ -297,23 +297,23 @@ public object SecondClassHierarchy_ZSealedEnum : SealedEnum 0 - SecondClassHierarchy.Z.X.W -> 1 - SecondClassHierarchy.Z.X.V -> 2 - SecondClassHierarchy.Z.X.U.T -> 3 - SecondClassHierarchy.Z.X.S.R -> 4 - SecondClassHierarchy.Z.Q.P -> 5 - SecondClassHierarchy.Z.O -> 6 + is SecondClassHierarchy.Z.Y -> 0 + is SecondClassHierarchy.Z.X.W -> 1 + is SecondClassHierarchy.Z.X.V -> 2 + is SecondClassHierarchy.Z.X.U.T -> 3 + is SecondClassHierarchy.Z.X.S.R -> 4 + is SecondClassHierarchy.Z.Q.P -> 5 + is SecondClassHierarchy.Z.O -> 6 } public override fun nameOf(obj: SecondClassHierarchy.Z): String = when (obj) { - SecondClassHierarchy.Z.Y -> "SecondClassHierarchy_Z_Y" - SecondClassHierarchy.Z.X.W -> "SecondClassHierarchy_Z_X_W" - SecondClassHierarchy.Z.X.V -> "SecondClassHierarchy_Z_X_V" - SecondClassHierarchy.Z.X.U.T -> "SecondClassHierarchy_Z_X_U_T" - SecondClassHierarchy.Z.X.S.R -> "SecondClassHierarchy_Z_X_S_R" - SecondClassHierarchy.Z.Q.P -> "SecondClassHierarchy_Z_Q_P" - SecondClassHierarchy.Z.O -> "SecondClassHierarchy_Z_O" + is SecondClassHierarchy.Z.Y -> "SecondClassHierarchy_Z_Y" + is SecondClassHierarchy.Z.X.W -> "SecondClassHierarchy_Z_X_W" + is SecondClassHierarchy.Z.X.V -> "SecondClassHierarchy_Z_X_V" + is SecondClassHierarchy.Z.X.U.T -> "SecondClassHierarchy_Z_X_U_T" + is SecondClassHierarchy.Z.X.S.R -> "SecondClassHierarchy_Z_X_S_R" + is SecondClassHierarchy.Z.Q.P -> "SecondClassHierarchy_Z_Q_P" + is SecondClassHierarchy.Z.O -> "SecondClassHierarchy_Z_O" } public override fun valueOf(name: String): SecondClassHierarchy.Z = when (name) { @@ -385,17 +385,17 @@ public object SecondClassHierarchy_Z_XSealedEnum : SealedEnum 0 - SecondClassHierarchy.Z.X.V -> 1 - SecondClassHierarchy.Z.X.U.T -> 2 - SecondClassHierarchy.Z.X.S.R -> 3 + is SecondClassHierarchy.Z.X.W -> 0 + is SecondClassHierarchy.Z.X.V -> 1 + is SecondClassHierarchy.Z.X.U.T -> 2 + is SecondClassHierarchy.Z.X.S.R -> 3 } public override fun nameOf(obj: SecondClassHierarchy.Z.X): String = when (obj) { - SecondClassHierarchy.Z.X.W -> "SecondClassHierarchy_Z_X_W" - SecondClassHierarchy.Z.X.V -> "SecondClassHierarchy_Z_X_V" - SecondClassHierarchy.Z.X.U.T -> "SecondClassHierarchy_Z_X_U_T" - SecondClassHierarchy.Z.X.S.R -> "SecondClassHierarchy_Z_X_S_R" + is SecondClassHierarchy.Z.X.W -> "SecondClassHierarchy_Z_X_W" + is SecondClassHierarchy.Z.X.V -> "SecondClassHierarchy_Z_X_V" + is SecondClassHierarchy.Z.X.U.T -> "SecondClassHierarchy_Z_X_U_T" + is SecondClassHierarchy.Z.X.S.R -> "SecondClassHierarchy_Z_X_S_R" } public override fun valueOf(name: String): SecondClassHierarchy.Z.X = when (name) { @@ -461,11 +461,11 @@ public object SecondClassHierarchy_Z_X_USealedEnum : SealedEnum 0 + is SecondClassHierarchy.Z.X.U.T -> 0 } public override fun nameOf(obj: SecondClassHierarchy.Z.X.U): String = when (obj) { - SecondClassHierarchy.Z.X.U.T -> "SecondClassHierarchy_Z_X_U_T" + is SecondClassHierarchy.Z.X.U.T -> "SecondClassHierarchy_Z_X_U_T" } public override fun valueOf(name: String): SecondClassHierarchy.Z.X.U = when (name) { @@ -528,11 +528,11 @@ public object SecondClassHierarchy_Z_X_SSealedEnum : SealedEnum 0 + is SecondClassHierarchy.Z.X.S.R -> 0 } public override fun nameOf(obj: SecondClassHierarchy.Z.X.S): String = when (obj) { - SecondClassHierarchy.Z.X.S.R -> "SecondClassHierarchy_Z_X_S_R" + is SecondClassHierarchy.Z.X.S.R -> "SecondClassHierarchy_Z_X_S_R" } public override fun valueOf(name: String): SecondClassHierarchy.Z.X.S = when (name) { @@ -595,11 +595,11 @@ public object SecondClassHierarchy_Z_QSealedEnum : SealedEnum 0 + is SecondClassHierarchy.Z.Q.P -> 0 } public override fun nameOf(obj: SecondClassHierarchy.Z.Q): String = when (obj) { - SecondClassHierarchy.Z.Q.P -> "SecondClassHierarchy_Z_Q_P" + is SecondClassHierarchy.Z.Q.P -> "SecondClassHierarchy_Z_Q_P" } public override fun valueOf(name: String): SecondClassHierarchy.Z.Q = when (name) { diff --git a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/hierarchy/SealedInterfaceHierarchy.kt b/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/hierarchy/SealedInterfaceHierarchy.kt index 6c4d7a8e..b7f15a51 100644 --- a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/hierarchy/SealedInterfaceHierarchy.kt +++ b/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/hierarchy/SealedInterfaceHierarchy.kt @@ -65,11 +65,11 @@ public object FirstInterfaceHierarchy_ASealedEnum : SealedEnum 0 + is FirstInterfaceHierarchy.A.B.C -> 0 } public override fun nameOf(obj: FirstInterfaceHierarchy.A): String = when (obj) { - FirstInterfaceHierarchy.A.B.C -> "FirstInterfaceHierarchy_A_B_C" + is FirstInterfaceHierarchy.A.B.C -> "FirstInterfaceHierarchy_A_B_C" } public override fun valueOf(name: String): FirstInterfaceHierarchy.A = when (name) { @@ -79,7 +79,8 @@ public object FirstInterfaceHierarchy_ASealedEnum : SealedEnum FirstInterfaceHierarchy_AEnum.FirstInterfaceHierarchy_A_B_C + is FirstInterfaceHierarchy.A.B.C -> + FirstInterfaceHierarchy_AEnum.FirstInterfaceHierarchy_A_B_C } public override fun enumToSealedObject(`enum`: FirstInterfaceHierarchy_AEnum): @@ -169,11 +170,11 @@ public object FirstInterfaceHierarchy_A_BSealedEnum : SealedEnum 0 + is FirstInterfaceHierarchy.A.B.C -> 0 } public override fun nameOf(obj: FirstInterfaceHierarchy.A.B): String = when (obj) { - FirstInterfaceHierarchy.A.B.C -> "FirstInterfaceHierarchy_A_B_C" + is FirstInterfaceHierarchy.A.B.C -> "FirstInterfaceHierarchy_A_B_C" } public override fun valueOf(name: String): FirstInterfaceHierarchy.A.B = when (name) { @@ -183,7 +184,7 @@ public object FirstInterfaceHierarchy_A_BSealedEnum : SealedEnum + is FirstInterfaceHierarchy.A.B.C -> FirstInterfaceHierarchy_A_BEnum.FirstInterfaceHierarchy_A_B_C } @@ -299,23 +300,23 @@ public object SecondInterfaceHierarchy_ASealedEnum : SealedEnum 0 - SecondInterfaceHierarchy.A.C.D -> 1 - SecondInterfaceHierarchy.A.C.E -> 2 - SecondInterfaceHierarchy.A.C.F.G -> 3 - SecondInterfaceHierarchy.A.C.H.I -> 4 - SecondInterfaceHierarchy.A.J.K -> 5 - SecondInterfaceHierarchy.A.L -> 6 + is SecondInterfaceHierarchy.A.B -> 0 + is SecondInterfaceHierarchy.A.C.D -> 1 + is SecondInterfaceHierarchy.A.C.E -> 2 + is SecondInterfaceHierarchy.A.C.F.G -> 3 + is SecondInterfaceHierarchy.A.C.H.I -> 4 + is SecondInterfaceHierarchy.A.J.K -> 5 + is SecondInterfaceHierarchy.A.L -> 6 } public override fun nameOf(obj: SecondInterfaceHierarchy.A): String = when (obj) { - SecondInterfaceHierarchy.A.B -> "SecondInterfaceHierarchy_A_B" - SecondInterfaceHierarchy.A.C.D -> "SecondInterfaceHierarchy_A_C_D" - SecondInterfaceHierarchy.A.C.E -> "SecondInterfaceHierarchy_A_C_E" - SecondInterfaceHierarchy.A.C.F.G -> "SecondInterfaceHierarchy_A_C_F_G" - SecondInterfaceHierarchy.A.C.H.I -> "SecondInterfaceHierarchy_A_C_H_I" - SecondInterfaceHierarchy.A.J.K -> "SecondInterfaceHierarchy_A_J_K" - SecondInterfaceHierarchy.A.L -> "SecondInterfaceHierarchy_A_L" + is SecondInterfaceHierarchy.A.B -> "SecondInterfaceHierarchy_A_B" + is SecondInterfaceHierarchy.A.C.D -> "SecondInterfaceHierarchy_A_C_D" + is SecondInterfaceHierarchy.A.C.E -> "SecondInterfaceHierarchy_A_C_E" + is SecondInterfaceHierarchy.A.C.F.G -> "SecondInterfaceHierarchy_A_C_F_G" + is SecondInterfaceHierarchy.A.C.H.I -> "SecondInterfaceHierarchy_A_C_H_I" + is SecondInterfaceHierarchy.A.J.K -> "SecondInterfaceHierarchy_A_J_K" + is SecondInterfaceHierarchy.A.L -> "SecondInterfaceHierarchy_A_L" } public override fun valueOf(name: String): SecondInterfaceHierarchy.A = when (name) { @@ -387,17 +388,17 @@ public object SecondInterfaceHierarchy_A_CSealedEnum : SealedEnum 0 - SecondInterfaceHierarchy.A.C.E -> 1 - SecondInterfaceHierarchy.A.C.F.G -> 2 - SecondInterfaceHierarchy.A.C.H.I -> 3 + is SecondInterfaceHierarchy.A.C.D -> 0 + is SecondInterfaceHierarchy.A.C.E -> 1 + is SecondInterfaceHierarchy.A.C.F.G -> 2 + is SecondInterfaceHierarchy.A.C.H.I -> 3 } public override fun nameOf(obj: SecondInterfaceHierarchy.A.C): String = when (obj) { - SecondInterfaceHierarchy.A.C.D -> "SecondInterfaceHierarchy_A_C_D" - SecondInterfaceHierarchy.A.C.E -> "SecondInterfaceHierarchy_A_C_E" - SecondInterfaceHierarchy.A.C.F.G -> "SecondInterfaceHierarchy_A_C_F_G" - SecondInterfaceHierarchy.A.C.H.I -> "SecondInterfaceHierarchy_A_C_H_I" + is SecondInterfaceHierarchy.A.C.D -> "SecondInterfaceHierarchy_A_C_D" + is SecondInterfaceHierarchy.A.C.E -> "SecondInterfaceHierarchy_A_C_E" + is SecondInterfaceHierarchy.A.C.F.G -> "SecondInterfaceHierarchy_A_C_F_G" + is SecondInterfaceHierarchy.A.C.H.I -> "SecondInterfaceHierarchy_A_C_H_I" } public override fun valueOf(name: String): SecondInterfaceHierarchy.A.C = when (name) { @@ -464,11 +465,11 @@ public object SecondInterfaceHierarchy_A_C_FSealedEnum : SealedEnum 0 + is SecondInterfaceHierarchy.A.C.F.G -> 0 } public override fun nameOf(obj: SecondInterfaceHierarchy.A.C.F): String = when (obj) { - SecondInterfaceHierarchy.A.C.F.G -> "SecondInterfaceHierarchy_A_C_F_G" + is SecondInterfaceHierarchy.A.C.F.G -> "SecondInterfaceHierarchy_A_C_F_G" } public override fun valueOf(name: String): SecondInterfaceHierarchy.A.C.F = when (name) { @@ -533,11 +534,11 @@ public object SecondInterfaceHierarchy_A_C_HSealedEnum : SealedEnum 0 + is SecondInterfaceHierarchy.A.C.H.I -> 0 } public override fun nameOf(obj: SecondInterfaceHierarchy.A.C.H): String = when (obj) { - SecondInterfaceHierarchy.A.C.H.I -> "SecondInterfaceHierarchy_A_C_H_I" + is SecondInterfaceHierarchy.A.C.H.I -> "SecondInterfaceHierarchy_A_C_H_I" } public override fun valueOf(name: String): SecondInterfaceHierarchy.A.C.H = when (name) { @@ -601,11 +602,11 @@ public object SecondInterfaceHierarchy_A_JSealedEnum : SealedEnum 0 + is SecondInterfaceHierarchy.A.J.K -> 0 } public override fun nameOf(obj: SecondInterfaceHierarchy.A.J): String = when (obj) { - SecondInterfaceHierarchy.A.J.K -> "SecondInterfaceHierarchy_A_J_K" + is SecondInterfaceHierarchy.A.J.K -> "SecondInterfaceHierarchy_A_J_K" } public override fun valueOf(name: String): SecondInterfaceHierarchy.A.J = when (name) { diff --git a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/location/NestedClass.kt b/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/location/NestedClass.kt index f9c935f3..811960a9 100644 --- a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/location/NestedClass.kt +++ b/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/location/NestedClass.kt @@ -35,14 +35,14 @@ public object OuterClass_InsideOneClassSealedClassSealedEnum : public override fun ordinalOf(obj: OuterClass.InsideOneClassSealedClass): Int = when (obj) { - OuterClass.InsideOneClassSealedClass.FirstObject -> 0 - OuterClass.InsideOneClassSealedClass.SecondObject -> 1 + is OuterClass.InsideOneClassSealedClass.FirstObject -> 0 + is OuterClass.InsideOneClassSealedClass.SecondObject -> 1 } public override fun nameOf(obj: OuterClass.InsideOneClassSealedClass): String = when (obj) { - OuterClass.InsideOneClassSealedClass.FirstObject -> + is OuterClass.InsideOneClassSealedClass.FirstObject -> "OuterClass_InsideOneClassSealedClass_FirstObject" - OuterClass.InsideOneClassSealedClass.SecondObject -> + is OuterClass.InsideOneClassSealedClass.SecondObject -> "OuterClass_InsideOneClassSealedClass_SecondObject" } @@ -132,15 +132,15 @@ public object FirstOuterClass_SecondOuterClass_InsideTwoClassesSealedClassSealed public override fun ordinalOf(obj: FirstOuterClass.SecondOuterClass.InsideTwoClassesSealedClass): Int = when (obj) { - FirstOuterClass.SecondOuterClass.InsideTwoClassesSealedClass.FirstObject -> 0 - FirstOuterClass.SecondOuterClass.InsideTwoClassesSealedClass.SecondObject -> 1 + is FirstOuterClass.SecondOuterClass.InsideTwoClassesSealedClass.FirstObject -> 0 + is FirstOuterClass.SecondOuterClass.InsideTwoClassesSealedClass.SecondObject -> 1 } public override fun nameOf(obj: FirstOuterClass.SecondOuterClass.InsideTwoClassesSealedClass): String = when (obj) { - FirstOuterClass.SecondOuterClass.InsideTwoClassesSealedClass.FirstObject -> + is FirstOuterClass.SecondOuterClass.InsideTwoClassesSealedClass.FirstObject -> "FirstOuterClass_SecondOuterClass_InsideTwoClassesSealedClass_FirstObject" - FirstOuterClass.SecondOuterClass.InsideTwoClassesSealedClass.SecondObject -> + is FirstOuterClass.SecondOuterClass.InsideTwoClassesSealedClass.SecondObject -> "FirstOuterClass_SecondOuterClass_InsideTwoClassesSealedClass_SecondObject" } diff --git a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/location/OutsideSealedClass.kt b/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/location/OutsideSealedClass.kt index 61898425..d53c4e43 100644 --- a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/location/OutsideSealedClass.kt +++ b/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/location/OutsideSealedClass.kt @@ -56,11 +56,11 @@ public object AlphaOutsideSealedClassSealedEnum : SealedEnum 0 + is AlphaFirstObject -> 0 } public override fun nameOf(obj: AlphaOutsideSealedClass): String = when (obj) { - AlphaFirstObject -> "AlphaFirstObject" + is AlphaFirstObject -> "AlphaFirstObject" } public override fun valueOf(name: String): AlphaOutsideSealedClass = when (name) { @@ -70,7 +70,7 @@ public object AlphaOutsideSealedClassSealedEnum : SealedEnum AlphaOutsideSealedClassEnum.AlphaFirstObject + is AlphaFirstObject -> AlphaOutsideSealedClassEnum.AlphaFirstObject } public override fun enumToSealedObject(`enum`: AlphaOutsideSealedClassEnum): @@ -179,17 +179,17 @@ public object BetaOutsideSealedClassSealedEnum : SealedEnum 0 - BetaFourthObject -> 1 - BetaSecondObject -> 2 - BetaThirdObject -> 3 + is BetaFirstObject -> 0 + is BetaFourthObject -> 1 + is BetaSecondObject -> 2 + is BetaThirdObject -> 3 } public override fun nameOf(obj: BetaOutsideSealedClass): String = when (obj) { - BetaFirstObject -> "BetaFirstObject" - BetaFourthObject -> "BetaFourthObject" - BetaSecondObject -> "BetaSecondObject" - BetaThirdObject -> "BetaThirdObject" + is BetaFirstObject -> "BetaFirstObject" + is BetaFourthObject -> "BetaFourthObject" + is BetaSecondObject -> "BetaSecondObject" + is BetaThirdObject -> "BetaThirdObject" } public override fun valueOf(name: String): BetaOutsideSealedClass = when (name) { @@ -202,10 +202,10 @@ public object BetaOutsideSealedClassSealedEnum : SealedEnum BetaOutsideSealedClassEnum.BetaFirstObject - BetaFourthObject -> BetaOutsideSealedClassEnum.BetaFourthObject - BetaSecondObject -> BetaOutsideSealedClassEnum.BetaSecondObject - BetaThirdObject -> BetaOutsideSealedClassEnum.BetaThirdObject + is BetaFirstObject -> BetaOutsideSealedClassEnum.BetaFirstObject + is BetaFourthObject -> BetaOutsideSealedClassEnum.BetaFourthObject + is BetaSecondObject -> BetaOutsideSealedClassEnum.BetaSecondObject + is BetaThirdObject -> BetaOutsideSealedClassEnum.BetaThirdObject } public override fun enumToSealedObject(`enum`: BetaOutsideSealedClassEnum): @@ -318,17 +318,17 @@ public object GammaOutsideSealedClassSealedEnum : SealedEnum 0 - GammaFirstObject -> 1 - GammaFourthObject -> 2 - GammaThirdObject -> 3 + is GammaOutsideSealedClass.GammaSecondObject -> 0 + is GammaFirstObject -> 1 + is GammaFourthObject -> 2 + is GammaThirdObject -> 3 } public override fun nameOf(obj: GammaOutsideSealedClass): String = when (obj) { - GammaOutsideSealedClass.GammaSecondObject -> "GammaOutsideSealedClass_GammaSecondObject" - GammaFirstObject -> "GammaFirstObject" - GammaFourthObject -> "GammaFourthObject" - GammaThirdObject -> "GammaThirdObject" + is GammaOutsideSealedClass.GammaSecondObject -> "GammaOutsideSealedClass_GammaSecondObject" + is GammaFirstObject -> "GammaFirstObject" + is GammaFourthObject -> "GammaFourthObject" + is GammaThirdObject -> "GammaThirdObject" } public override fun valueOf(name: String): GammaOutsideSealedClass = when (name) { @@ -341,11 +341,11 @@ public object GammaOutsideSealedClassSealedEnum : SealedEnum + is GammaOutsideSealedClass.GammaSecondObject -> GammaOutsideSealedClassEnum.GammaOutsideSealedClass_GammaSecondObject - GammaFirstObject -> GammaOutsideSealedClassEnum.GammaFirstObject - GammaFourthObject -> GammaOutsideSealedClassEnum.GammaFourthObject - GammaThirdObject -> GammaOutsideSealedClassEnum.GammaThirdObject + is GammaFirstObject -> GammaOutsideSealedClassEnum.GammaFirstObject + is GammaFourthObject -> GammaOutsideSealedClassEnum.GammaFourthObject + is GammaThirdObject -> GammaOutsideSealedClassEnum.GammaThirdObject } public override fun enumToSealedObject(`enum`: GammaOutsideSealedClassEnum): @@ -450,13 +450,13 @@ public object DeltaOutsideSealedClassSealedEnum : SealedEnum 0 - DeltaObject -> 1 + is DeltaOutsideSealedClass.DeltaObject -> 0 + is DeltaObject -> 1 } public override fun nameOf(obj: DeltaOutsideSealedClass): String = when (obj) { - DeltaOutsideSealedClass.DeltaObject -> "DeltaOutsideSealedClass_DeltaObject" - DeltaObject -> "DeltaObject" + is DeltaOutsideSealedClass.DeltaObject -> "DeltaOutsideSealedClass_DeltaObject" + is DeltaObject -> "DeltaObject" } public override fun valueOf(name: String): DeltaOutsideSealedClass = when (name) { @@ -467,9 +467,9 @@ public object DeltaOutsideSealedClassSealedEnum : SealedEnum + is DeltaOutsideSealedClass.DeltaObject -> DeltaOutsideSealedClassEnum.DeltaOutsideSealedClass_DeltaObject - DeltaObject -> DeltaOutsideSealedClassEnum.DeltaObject + is DeltaObject -> DeltaOutsideSealedClassEnum.DeltaObject } public override fun enumToSealedObject(`enum`: DeltaOutsideSealedClassEnum): diff --git a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/location/SplitAcrossFilesSealedClass.kt b/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/location/SplitAcrossFilesSealedClass.kt index cdd74a4a..b6cc2c70 100644 --- a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/location/SplitAcrossFilesSealedClass.kt +++ b/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/location/SplitAcrossFilesSealedClass.kt @@ -59,15 +59,15 @@ public object SplitAcrossFilesSealedClassSealedEnum : SealedEnum 0 - SplitAcrossFilesSubclassB -> 1 - SplitAcrossFilesSubclassC -> 2 + is SplitAcrossFilesSubclassA -> 0 + is SplitAcrossFilesSubclassB -> 1 + is SplitAcrossFilesSubclassC -> 2 } public override fun nameOf(obj: SplitAcrossFilesSealedClass): String = when (obj) { - SplitAcrossFilesSubclassA -> "SplitAcrossFilesSubclassA" - SplitAcrossFilesSubclassB -> "SplitAcrossFilesSubclassB" - SplitAcrossFilesSubclassC -> "SplitAcrossFilesSubclassC" + is SplitAcrossFilesSubclassA -> "SplitAcrossFilesSubclassA" + is SplitAcrossFilesSubclassB -> "SplitAcrossFilesSubclassB" + is SplitAcrossFilesSubclassC -> "SplitAcrossFilesSubclassC" } public override fun valueOf(name: String): SplitAcrossFilesSealedClass = when (name) { @@ -79,9 +79,9 @@ public object SplitAcrossFilesSealedClassSealedEnum : SealedEnum SplitAcrossFilesSealedClassEnum.SplitAcrossFilesSubclassA - SplitAcrossFilesSubclassB -> SplitAcrossFilesSealedClassEnum.SplitAcrossFilesSubclassB - SplitAcrossFilesSubclassC -> SplitAcrossFilesSealedClassEnum.SplitAcrossFilesSubclassC + is SplitAcrossFilesSubclassA -> SplitAcrossFilesSealedClassEnum.SplitAcrossFilesSubclassA + is SplitAcrossFilesSubclassB -> SplitAcrossFilesSealedClassEnum.SplitAcrossFilesSubclassB + is SplitAcrossFilesSubclassC -> SplitAcrossFilesSealedClassEnum.SplitAcrossFilesSubclassC } public override fun enumToSealedObject(`enum`: SplitAcrossFilesSealedClassEnum): diff --git a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/traversal/TraversalOrder.kt b/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/traversal/TraversalOrder.kt index 615fd780..3bce2421 100644 --- a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/traversal/TraversalOrder.kt +++ b/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/traversal/TraversalOrder.kt @@ -133,37 +133,37 @@ public object TreeLevelOrderSealedEnum : SealedEnum, get() = TreeLevelOrderEnum::class public override fun ordinalOf(obj: Tree): Int = when (obj) { - Tree.A -> 0 - Tree.K -> 1 - Tree.T -> 2 - Tree.L.S -> 3 - Tree.B.C.D -> 4 - Tree.B.C.E -> 5 - Tree.B.C.J -> 6 - Tree.L.M.N -> 7 - Tree.L.M.O -> 8 - Tree.L.P.Q -> 9 - Tree.L.P.R -> 10 - Tree.B.C.F.G -> 11 - Tree.B.C.F.H -> 12 - Tree.B.C.F.I -> 13 + is Tree.A -> 0 + is Tree.K -> 1 + is Tree.T -> 2 + is Tree.L.S -> 3 + is Tree.B.C.D -> 4 + is Tree.B.C.E -> 5 + is Tree.B.C.J -> 6 + is Tree.L.M.N -> 7 + is Tree.L.M.O -> 8 + is Tree.L.P.Q -> 9 + is Tree.L.P.R -> 10 + is Tree.B.C.F.G -> 11 + is Tree.B.C.F.H -> 12 + is Tree.B.C.F.I -> 13 } public override fun nameOf(obj: Tree): String = when (obj) { - Tree.A -> "Tree_A" - Tree.K -> "Tree_K" - Tree.T -> "Tree_T" - Tree.L.S -> "Tree_L_S" - Tree.B.C.D -> "Tree_B_C_D" - Tree.B.C.E -> "Tree_B_C_E" - Tree.B.C.J -> "Tree_B_C_J" - Tree.L.M.N -> "Tree_L_M_N" - Tree.L.M.O -> "Tree_L_M_O" - Tree.L.P.Q -> "Tree_L_P_Q" - Tree.L.P.R -> "Tree_L_P_R" - Tree.B.C.F.G -> "Tree_B_C_F_G" - Tree.B.C.F.H -> "Tree_B_C_F_H" - Tree.B.C.F.I -> "Tree_B_C_F_I" + is Tree.A -> "Tree_A" + is Tree.K -> "Tree_K" + is Tree.T -> "Tree_T" + is Tree.L.S -> "Tree_L_S" + is Tree.B.C.D -> "Tree_B_C_D" + is Tree.B.C.E -> "Tree_B_C_E" + is Tree.B.C.J -> "Tree_B_C_J" + is Tree.L.M.N -> "Tree_L_M_N" + is Tree.L.M.O -> "Tree_L_M_O" + is Tree.L.P.Q -> "Tree_L_P_Q" + is Tree.L.P.R -> "Tree_L_P_R" + is Tree.B.C.F.G -> "Tree_B_C_F_G" + is Tree.B.C.F.H -> "Tree_B_C_F_H" + is Tree.B.C.F.I -> "Tree_B_C_F_I" } public override fun valueOf(name: String): Tree = when (name) { @@ -185,20 +185,20 @@ public object TreeLevelOrderSealedEnum : SealedEnum, } public override fun sealedObjectToEnum(obj: Tree): TreeLevelOrderEnum = when (obj) { - Tree.A -> TreeLevelOrderEnum.Tree_A - Tree.K -> TreeLevelOrderEnum.Tree_K - Tree.T -> TreeLevelOrderEnum.Tree_T - Tree.L.S -> TreeLevelOrderEnum.Tree_L_S - Tree.B.C.D -> TreeLevelOrderEnum.Tree_B_C_D - Tree.B.C.E -> TreeLevelOrderEnum.Tree_B_C_E - Tree.B.C.J -> TreeLevelOrderEnum.Tree_B_C_J - Tree.L.M.N -> TreeLevelOrderEnum.Tree_L_M_N - Tree.L.M.O -> TreeLevelOrderEnum.Tree_L_M_O - Tree.L.P.Q -> TreeLevelOrderEnum.Tree_L_P_Q - Tree.L.P.R -> TreeLevelOrderEnum.Tree_L_P_R - Tree.B.C.F.G -> TreeLevelOrderEnum.Tree_B_C_F_G - Tree.B.C.F.H -> TreeLevelOrderEnum.Tree_B_C_F_H - Tree.B.C.F.I -> TreeLevelOrderEnum.Tree_B_C_F_I + is Tree.A -> TreeLevelOrderEnum.Tree_A + is Tree.K -> TreeLevelOrderEnum.Tree_K + is Tree.T -> TreeLevelOrderEnum.Tree_T + is Tree.L.S -> TreeLevelOrderEnum.Tree_L_S + is Tree.B.C.D -> TreeLevelOrderEnum.Tree_B_C_D + is Tree.B.C.E -> TreeLevelOrderEnum.Tree_B_C_E + is Tree.B.C.J -> TreeLevelOrderEnum.Tree_B_C_J + is Tree.L.M.N -> TreeLevelOrderEnum.Tree_L_M_N + is Tree.L.M.O -> TreeLevelOrderEnum.Tree_L_M_O + is Tree.L.P.Q -> TreeLevelOrderEnum.Tree_L_P_Q + is Tree.L.P.R -> TreeLevelOrderEnum.Tree_L_P_R + is Tree.B.C.F.G -> TreeLevelOrderEnum.Tree_B_C_F_G + is Tree.B.C.F.H -> TreeLevelOrderEnum.Tree_B_C_F_H + is Tree.B.C.F.I -> TreeLevelOrderEnum.Tree_B_C_F_I } public override fun enumToSealedObject(`enum`: TreeLevelOrderEnum): Tree = when (enum) { @@ -311,37 +311,37 @@ public object TreePostOrderSealedEnum : SealedEnum, get() = TreePostOrderEnum::class public override fun ordinalOf(obj: Tree): Int = when (obj) { - Tree.B.C.F.G -> 0 - Tree.B.C.F.H -> 1 - Tree.B.C.F.I -> 2 - Tree.B.C.D -> 3 - Tree.B.C.E -> 4 - Tree.B.C.J -> 5 - Tree.L.M.N -> 6 - Tree.L.M.O -> 7 - Tree.L.P.Q -> 8 - Tree.L.P.R -> 9 - Tree.L.S -> 10 - Tree.A -> 11 - Tree.K -> 12 - Tree.T -> 13 + is Tree.B.C.F.G -> 0 + is Tree.B.C.F.H -> 1 + is Tree.B.C.F.I -> 2 + is Tree.B.C.D -> 3 + is Tree.B.C.E -> 4 + is Tree.B.C.J -> 5 + is Tree.L.M.N -> 6 + is Tree.L.M.O -> 7 + is Tree.L.P.Q -> 8 + is Tree.L.P.R -> 9 + is Tree.L.S -> 10 + is Tree.A -> 11 + is Tree.K -> 12 + is Tree.T -> 13 } public override fun nameOf(obj: Tree): String = when (obj) { - Tree.B.C.F.G -> "Tree_B_C_F_G" - Tree.B.C.F.H -> "Tree_B_C_F_H" - Tree.B.C.F.I -> "Tree_B_C_F_I" - Tree.B.C.D -> "Tree_B_C_D" - Tree.B.C.E -> "Tree_B_C_E" - Tree.B.C.J -> "Tree_B_C_J" - Tree.L.M.N -> "Tree_L_M_N" - Tree.L.M.O -> "Tree_L_M_O" - Tree.L.P.Q -> "Tree_L_P_Q" - Tree.L.P.R -> "Tree_L_P_R" - Tree.L.S -> "Tree_L_S" - Tree.A -> "Tree_A" - Tree.K -> "Tree_K" - Tree.T -> "Tree_T" + is Tree.B.C.F.G -> "Tree_B_C_F_G" + is Tree.B.C.F.H -> "Tree_B_C_F_H" + is Tree.B.C.F.I -> "Tree_B_C_F_I" + is Tree.B.C.D -> "Tree_B_C_D" + is Tree.B.C.E -> "Tree_B_C_E" + is Tree.B.C.J -> "Tree_B_C_J" + is Tree.L.M.N -> "Tree_L_M_N" + is Tree.L.M.O -> "Tree_L_M_O" + is Tree.L.P.Q -> "Tree_L_P_Q" + is Tree.L.P.R -> "Tree_L_P_R" + is Tree.L.S -> "Tree_L_S" + is Tree.A -> "Tree_A" + is Tree.K -> "Tree_K" + is Tree.T -> "Tree_T" } public override fun valueOf(name: String): Tree = when (name) { @@ -363,20 +363,20 @@ public object TreePostOrderSealedEnum : SealedEnum, } public override fun sealedObjectToEnum(obj: Tree): TreePostOrderEnum = when (obj) { - Tree.B.C.F.G -> TreePostOrderEnum.Tree_B_C_F_G - Tree.B.C.F.H -> TreePostOrderEnum.Tree_B_C_F_H - Tree.B.C.F.I -> TreePostOrderEnum.Tree_B_C_F_I - Tree.B.C.D -> TreePostOrderEnum.Tree_B_C_D - Tree.B.C.E -> TreePostOrderEnum.Tree_B_C_E - Tree.B.C.J -> TreePostOrderEnum.Tree_B_C_J - Tree.L.M.N -> TreePostOrderEnum.Tree_L_M_N - Tree.L.M.O -> TreePostOrderEnum.Tree_L_M_O - Tree.L.P.Q -> TreePostOrderEnum.Tree_L_P_Q - Tree.L.P.R -> TreePostOrderEnum.Tree_L_P_R - Tree.L.S -> TreePostOrderEnum.Tree_L_S - Tree.A -> TreePostOrderEnum.Tree_A - Tree.K -> TreePostOrderEnum.Tree_K - Tree.T -> TreePostOrderEnum.Tree_T + is Tree.B.C.F.G -> TreePostOrderEnum.Tree_B_C_F_G + is Tree.B.C.F.H -> TreePostOrderEnum.Tree_B_C_F_H + is Tree.B.C.F.I -> TreePostOrderEnum.Tree_B_C_F_I + is Tree.B.C.D -> TreePostOrderEnum.Tree_B_C_D + is Tree.B.C.E -> TreePostOrderEnum.Tree_B_C_E + is Tree.B.C.J -> TreePostOrderEnum.Tree_B_C_J + is Tree.L.M.N -> TreePostOrderEnum.Tree_L_M_N + is Tree.L.M.O -> TreePostOrderEnum.Tree_L_M_O + is Tree.L.P.Q -> TreePostOrderEnum.Tree_L_P_Q + is Tree.L.P.R -> TreePostOrderEnum.Tree_L_P_R + is Tree.L.S -> TreePostOrderEnum.Tree_L_S + is Tree.A -> TreePostOrderEnum.Tree_A + is Tree.K -> TreePostOrderEnum.Tree_K + is Tree.T -> TreePostOrderEnum.Tree_T } public override fun enumToSealedObject(`enum`: TreePostOrderEnum): Tree = when (enum) { @@ -489,37 +489,37 @@ public object TreeInOrderSealedEnum : SealedEnum, get() = TreeInOrderEnum::class public override fun ordinalOf(obj: Tree): Int = when (obj) { - Tree.A -> 0 - Tree.B.C.D -> 1 - Tree.B.C.E -> 2 - Tree.B.C.F.G -> 3 - Tree.B.C.F.H -> 4 - Tree.B.C.F.I -> 5 - Tree.B.C.J -> 6 - Tree.K -> 7 - Tree.L.M.N -> 8 - Tree.L.M.O -> 9 - Tree.L.P.Q -> 10 - Tree.L.P.R -> 11 - Tree.L.S -> 12 - Tree.T -> 13 + is Tree.A -> 0 + is Tree.B.C.D -> 1 + is Tree.B.C.E -> 2 + is Tree.B.C.F.G -> 3 + is Tree.B.C.F.H -> 4 + is Tree.B.C.F.I -> 5 + is Tree.B.C.J -> 6 + is Tree.K -> 7 + is Tree.L.M.N -> 8 + is Tree.L.M.O -> 9 + is Tree.L.P.Q -> 10 + is Tree.L.P.R -> 11 + is Tree.L.S -> 12 + is Tree.T -> 13 } public override fun nameOf(obj: Tree): String = when (obj) { - Tree.A -> "Tree_A" - Tree.B.C.D -> "Tree_B_C_D" - Tree.B.C.E -> "Tree_B_C_E" - Tree.B.C.F.G -> "Tree_B_C_F_G" - Tree.B.C.F.H -> "Tree_B_C_F_H" - Tree.B.C.F.I -> "Tree_B_C_F_I" - Tree.B.C.J -> "Tree_B_C_J" - Tree.K -> "Tree_K" - Tree.L.M.N -> "Tree_L_M_N" - Tree.L.M.O -> "Tree_L_M_O" - Tree.L.P.Q -> "Tree_L_P_Q" - Tree.L.P.R -> "Tree_L_P_R" - Tree.L.S -> "Tree_L_S" - Tree.T -> "Tree_T" + is Tree.A -> "Tree_A" + is Tree.B.C.D -> "Tree_B_C_D" + is Tree.B.C.E -> "Tree_B_C_E" + is Tree.B.C.F.G -> "Tree_B_C_F_G" + is Tree.B.C.F.H -> "Tree_B_C_F_H" + is Tree.B.C.F.I -> "Tree_B_C_F_I" + is Tree.B.C.J -> "Tree_B_C_J" + is Tree.K -> "Tree_K" + is Tree.L.M.N -> "Tree_L_M_N" + is Tree.L.M.O -> "Tree_L_M_O" + is Tree.L.P.Q -> "Tree_L_P_Q" + is Tree.L.P.R -> "Tree_L_P_R" + is Tree.L.S -> "Tree_L_S" + is Tree.T -> "Tree_T" } public override fun valueOf(name: String): Tree = when (name) { @@ -541,20 +541,20 @@ public object TreeInOrderSealedEnum : SealedEnum, } public override fun sealedObjectToEnum(obj: Tree): TreeInOrderEnum = when (obj) { - Tree.A -> TreeInOrderEnum.Tree_A - Tree.B.C.D -> TreeInOrderEnum.Tree_B_C_D - Tree.B.C.E -> TreeInOrderEnum.Tree_B_C_E - Tree.B.C.F.G -> TreeInOrderEnum.Tree_B_C_F_G - Tree.B.C.F.H -> TreeInOrderEnum.Tree_B_C_F_H - Tree.B.C.F.I -> TreeInOrderEnum.Tree_B_C_F_I - Tree.B.C.J -> TreeInOrderEnum.Tree_B_C_J - Tree.K -> TreeInOrderEnum.Tree_K - Tree.L.M.N -> TreeInOrderEnum.Tree_L_M_N - Tree.L.M.O -> TreeInOrderEnum.Tree_L_M_O - Tree.L.P.Q -> TreeInOrderEnum.Tree_L_P_Q - Tree.L.P.R -> TreeInOrderEnum.Tree_L_P_R - Tree.L.S -> TreeInOrderEnum.Tree_L_S - Tree.T -> TreeInOrderEnum.Tree_T + is Tree.A -> TreeInOrderEnum.Tree_A + is Tree.B.C.D -> TreeInOrderEnum.Tree_B_C_D + is Tree.B.C.E -> TreeInOrderEnum.Tree_B_C_E + is Tree.B.C.F.G -> TreeInOrderEnum.Tree_B_C_F_G + is Tree.B.C.F.H -> TreeInOrderEnum.Tree_B_C_F_H + is Tree.B.C.F.I -> TreeInOrderEnum.Tree_B_C_F_I + is Tree.B.C.J -> TreeInOrderEnum.Tree_B_C_J + is Tree.K -> TreeInOrderEnum.Tree_K + is Tree.L.M.N -> TreeInOrderEnum.Tree_L_M_N + is Tree.L.M.O -> TreeInOrderEnum.Tree_L_M_O + is Tree.L.P.Q -> TreeInOrderEnum.Tree_L_P_Q + is Tree.L.P.R -> TreeInOrderEnum.Tree_L_P_R + is Tree.L.S -> TreeInOrderEnum.Tree_L_S + is Tree.T -> TreeInOrderEnum.Tree_T } public override fun enumToSealedObject(`enum`: TreeInOrderEnum): Tree = when (enum) { @@ -666,37 +666,37 @@ public object TreePreOrderSealedEnum : SealedEnum, get() = TreePreOrderEnum::class public override fun ordinalOf(obj: Tree): Int = when (obj) { - Tree.A -> 0 - Tree.K -> 1 - Tree.T -> 2 - Tree.B.C.D -> 3 - Tree.B.C.E -> 4 - Tree.B.C.J -> 5 - Tree.B.C.F.G -> 6 - Tree.B.C.F.H -> 7 - Tree.B.C.F.I -> 8 - Tree.L.S -> 9 - Tree.L.M.N -> 10 - Tree.L.M.O -> 11 - Tree.L.P.Q -> 12 - Tree.L.P.R -> 13 + is Tree.A -> 0 + is Tree.K -> 1 + is Tree.T -> 2 + is Tree.B.C.D -> 3 + is Tree.B.C.E -> 4 + is Tree.B.C.J -> 5 + is Tree.B.C.F.G -> 6 + is Tree.B.C.F.H -> 7 + is Tree.B.C.F.I -> 8 + is Tree.L.S -> 9 + is Tree.L.M.N -> 10 + is Tree.L.M.O -> 11 + is Tree.L.P.Q -> 12 + is Tree.L.P.R -> 13 } public override fun nameOf(obj: Tree): String = when (obj) { - Tree.A -> "Tree_A" - Tree.K -> "Tree_K" - Tree.T -> "Tree_T" - Tree.B.C.D -> "Tree_B_C_D" - Tree.B.C.E -> "Tree_B_C_E" - Tree.B.C.J -> "Tree_B_C_J" - Tree.B.C.F.G -> "Tree_B_C_F_G" - Tree.B.C.F.H -> "Tree_B_C_F_H" - Tree.B.C.F.I -> "Tree_B_C_F_I" - Tree.L.S -> "Tree_L_S" - Tree.L.M.N -> "Tree_L_M_N" - Tree.L.M.O -> "Tree_L_M_O" - Tree.L.P.Q -> "Tree_L_P_Q" - Tree.L.P.R -> "Tree_L_P_R" + is Tree.A -> "Tree_A" + is Tree.K -> "Tree_K" + is Tree.T -> "Tree_T" + is Tree.B.C.D -> "Tree_B_C_D" + is Tree.B.C.E -> "Tree_B_C_E" + is Tree.B.C.J -> "Tree_B_C_J" + is Tree.B.C.F.G -> "Tree_B_C_F_G" + is Tree.B.C.F.H -> "Tree_B_C_F_H" + is Tree.B.C.F.I -> "Tree_B_C_F_I" + is Tree.L.S -> "Tree_L_S" + is Tree.L.M.N -> "Tree_L_M_N" + is Tree.L.M.O -> "Tree_L_M_O" + is Tree.L.P.Q -> "Tree_L_P_Q" + is Tree.L.P.R -> "Tree_L_P_R" } public override fun valueOf(name: String): Tree = when (name) { @@ -718,20 +718,20 @@ public object TreePreOrderSealedEnum : SealedEnum, } public override fun sealedObjectToEnum(obj: Tree): TreePreOrderEnum = when (obj) { - Tree.A -> TreePreOrderEnum.Tree_A - Tree.K -> TreePreOrderEnum.Tree_K - Tree.T -> TreePreOrderEnum.Tree_T - Tree.B.C.D -> TreePreOrderEnum.Tree_B_C_D - Tree.B.C.E -> TreePreOrderEnum.Tree_B_C_E - Tree.B.C.J -> TreePreOrderEnum.Tree_B_C_J - Tree.B.C.F.G -> TreePreOrderEnum.Tree_B_C_F_G - Tree.B.C.F.H -> TreePreOrderEnum.Tree_B_C_F_H - Tree.B.C.F.I -> TreePreOrderEnum.Tree_B_C_F_I - Tree.L.S -> TreePreOrderEnum.Tree_L_S - Tree.L.M.N -> TreePreOrderEnum.Tree_L_M_N - Tree.L.M.O -> TreePreOrderEnum.Tree_L_M_O - Tree.L.P.Q -> TreePreOrderEnum.Tree_L_P_Q - Tree.L.P.R -> TreePreOrderEnum.Tree_L_P_R + is Tree.A -> TreePreOrderEnum.Tree_A + is Tree.K -> TreePreOrderEnum.Tree_K + is Tree.T -> TreePreOrderEnum.Tree_T + is Tree.B.C.D -> TreePreOrderEnum.Tree_B_C_D + is Tree.B.C.E -> TreePreOrderEnum.Tree_B_C_E + is Tree.B.C.J -> TreePreOrderEnum.Tree_B_C_J + is Tree.B.C.F.G -> TreePreOrderEnum.Tree_B_C_F_G + is Tree.B.C.F.H -> TreePreOrderEnum.Tree_B_C_F_H + is Tree.B.C.F.I -> TreePreOrderEnum.Tree_B_C_F_I + is Tree.L.S -> TreePreOrderEnum.Tree_L_S + is Tree.L.M.N -> TreePreOrderEnum.Tree_L_M_N + is Tree.L.M.O -> TreePreOrderEnum.Tree_L_M_O + is Tree.L.P.Q -> TreePreOrderEnum.Tree_L_P_Q + is Tree.L.P.R -> TreePreOrderEnum.Tree_L_P_R } public override fun enumToSealedObject(`enum`: TreePreOrderEnum): Tree = when (enum) { diff --git a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/usecases/EnvironmentsSealedEnum.kt b/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/usecases/EnvironmentsSealedEnum.kt index cf1ba938..ae6b255b 100644 --- a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/usecases/EnvironmentsSealedEnum.kt +++ b/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/usecases/EnvironmentsSealedEnum.kt @@ -89,17 +89,17 @@ public object EnvironmentsSealedEnum : SealedEnum, get() = EnvironmentsEnum::class public override fun ordinalOf(obj: Environments): Int = when (obj) { - Environments.Http.Livefront -> 0 - Environments.Http.Google -> 1 - Environments.Https.Livefront -> 2 - Environments.Https.Google -> 3 + is Environments.Http.Livefront -> 0 + is Environments.Http.Google -> 1 + is Environments.Https.Livefront -> 2 + is Environments.Https.Google -> 3 } public override fun nameOf(obj: Environments): String = when (obj) { - Environments.Http.Livefront -> "Environments_Http_Livefront" - Environments.Http.Google -> "Environments_Http_Google" - Environments.Https.Livefront -> "Environments_Https_Livefront" - Environments.Https.Google -> "Environments_Https_Google" + is Environments.Http.Livefront -> "Environments_Http_Livefront" + is Environments.Http.Google -> "Environments_Http_Google" + is Environments.Https.Livefront -> "Environments_Https_Livefront" + is Environments.Https.Google -> "Environments_Https_Google" } public override fun valueOf(name: String): Environments = when (name) { @@ -111,10 +111,10 @@ public object EnvironmentsSealedEnum : SealedEnum, } public override fun sealedObjectToEnum(obj: Environments): EnvironmentsEnum = when (obj) { - Environments.Http.Livefront -> EnvironmentsEnum.Environments_Http_Livefront - Environments.Http.Google -> EnvironmentsEnum.Environments_Http_Google - Environments.Https.Livefront -> EnvironmentsEnum.Environments_Https_Livefront - Environments.Https.Google -> EnvironmentsEnum.Environments_Https_Google + is Environments.Http.Livefront -> EnvironmentsEnum.Environments_Http_Livefront + is Environments.Http.Google -> EnvironmentsEnum.Environments_Http_Google + is Environments.Https.Livefront -> EnvironmentsEnum.Environments_Https_Livefront + is Environments.Https.Google -> EnvironmentsEnum.Environments_Https_Google } public override fun enumToSealedObject(`enum`: EnvironmentsEnum): Environments = when (enum) { diff --git a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/visibility/PrivateInterfaceSealedClass.kt b/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/visibility/PrivateInterfaceSealedClass.kt index 1c57bfbc..a2d6e03e 100644 --- a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/visibility/PrivateInterfaceSealedClass.kt +++ b/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/visibility/PrivateInterfaceSealedClass.kt @@ -64,13 +64,13 @@ public object PrivateInterfaceSealedClassSealedEnum : SealedEnum 0 - PrivateInterfaceSealedClass.SecondObject -> 1 + is PrivateInterfaceSealedClass.FirstObject -> 0 + is PrivateInterfaceSealedClass.SecondObject -> 1 } public override fun nameOf(obj: PrivateInterfaceSealedClass): String = when (obj) { - PrivateInterfaceSealedClass.FirstObject -> "PrivateInterfaceSealedClass_FirstObject" - PrivateInterfaceSealedClass.SecondObject -> "PrivateInterfaceSealedClass_SecondObject" + is PrivateInterfaceSealedClass.FirstObject -> "PrivateInterfaceSealedClass_FirstObject" + is PrivateInterfaceSealedClass.SecondObject -> "PrivateInterfaceSealedClass_SecondObject" } public override fun valueOf(name: String): PrivateInterfaceSealedClass = when (name) { @@ -81,9 +81,9 @@ public object PrivateInterfaceSealedClassSealedEnum : SealedEnum + is PrivateInterfaceSealedClass.FirstObject -> PrivateInterfaceSealedClassEnum.PrivateInterfaceSealedClass_FirstObject - PrivateInterfaceSealedClass.SecondObject -> + is PrivateInterfaceSealedClass.SecondObject -> PrivateInterfaceSealedClassEnum.PrivateInterfaceSealedClass_SecondObject } diff --git a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/visibility/ProtectedInterfaceSealedClass.kt b/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/visibility/ProtectedInterfaceSealedClass.kt index 34ba9417..78275ef3 100644 --- a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/visibility/ProtectedInterfaceSealedClass.kt +++ b/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/visibility/ProtectedInterfaceSealedClass.kt @@ -82,15 +82,15 @@ public object ProtectedInterfaceOuterClass_ProtectedInterfaceSealedClassSealedEn public override fun ordinalOf(obj: ProtectedInterfaceOuterClass.ProtectedInterfaceSealedClass): Int = when (obj) { - ProtectedInterfaceOuterClass.ProtectedInterfaceSealedClass.FirstObject -> 0 - ProtectedInterfaceOuterClass.ProtectedInterfaceSealedClass.SecondObject -> 1 + is ProtectedInterfaceOuterClass.ProtectedInterfaceSealedClass.FirstObject -> 0 + is ProtectedInterfaceOuterClass.ProtectedInterfaceSealedClass.SecondObject -> 1 } public override fun nameOf(obj: ProtectedInterfaceOuterClass.ProtectedInterfaceSealedClass): String = when (obj) { - ProtectedInterfaceOuterClass.ProtectedInterfaceSealedClass.FirstObject -> + is ProtectedInterfaceOuterClass.ProtectedInterfaceSealedClass.FirstObject -> "ProtectedInterfaceOuterClass_ProtectedInterfaceSealedClass_FirstObject" - ProtectedInterfaceOuterClass.ProtectedInterfaceSealedClass.SecondObject -> + is ProtectedInterfaceOuterClass.ProtectedInterfaceSealedClass.SecondObject -> "ProtectedInterfaceOuterClass_ProtectedInterfaceSealedClass_SecondObject" } @@ -106,9 +106,9 @@ public object ProtectedInterfaceOuterClass_ProtectedInterfaceSealedClassSealedEn public override fun sealedObjectToEnum(obj: ProtectedInterfaceOuterClass.ProtectedInterfaceSealedClass): ProtectedInterfaceOuterClass_ProtectedInterfaceSealedClassEnum = when (obj) { - ProtectedInterfaceOuterClass.ProtectedInterfaceSealedClass.FirstObject -> + is ProtectedInterfaceOuterClass.ProtectedInterfaceSealedClass.FirstObject -> ProtectedInterfaceOuterClass_ProtectedInterfaceSealedClassEnum.ProtectedInterfaceOuterClass_ProtectedInterfaceSealedClass_FirstObject - ProtectedInterfaceOuterClass.ProtectedInterfaceSealedClass.SecondObject -> + is ProtectedInterfaceOuterClass.ProtectedInterfaceSealedClass.SecondObject -> ProtectedInterfaceOuterClass_ProtectedInterfaceSealedClassEnum.ProtectedInterfaceOuterClass_ProtectedInterfaceSealedClass_SecondObject } diff --git a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/visibility/ProtectedInterfaceSealedClassWithDifferentPackageBaseClass.kt b/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/visibility/ProtectedInterfaceSealedClassWithDifferentPackageBaseClass.kt index 378fb221..092e1e50 100644 --- a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/visibility/ProtectedInterfaceSealedClassWithDifferentPackageBaseClass.kt +++ b/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/visibility/ProtectedInterfaceSealedClassWithDifferentPackageBaseClass.kt @@ -94,18 +94,22 @@ public object public override fun ordinalOf(obj: ProtectedInterfaceOuterClassWithDifferentPackageBaseClass.ProtectedInterfaceSealedClass): Int = when (obj) { - ProtectedInterfaceOuterClassWithDifferentPackageBaseClass.ProtectedInterfaceSealedClass.FirstObject -> + is + ProtectedInterfaceOuterClassWithDifferentPackageBaseClass.ProtectedInterfaceSealedClass.FirstObject -> 0 - ProtectedInterfaceOuterClassWithDifferentPackageBaseClass.ProtectedInterfaceSealedClass.SecondObject -> + is + ProtectedInterfaceOuterClassWithDifferentPackageBaseClass.ProtectedInterfaceSealedClass.SecondObject -> 1 } public override fun nameOf(obj: ProtectedInterfaceOuterClassWithDifferentPackageBaseClass.ProtectedInterfaceSealedClass): String = when (obj) { - ProtectedInterfaceOuterClassWithDifferentPackageBaseClass.ProtectedInterfaceSealedClass.FirstObject -> + is + ProtectedInterfaceOuterClassWithDifferentPackageBaseClass.ProtectedInterfaceSealedClass.FirstObject -> "ProtectedInterfaceOuterClassWithDifferentPackageBaseClass_ProtectedInterfaceSealedClass_FirstObject" - ProtectedInterfaceOuterClassWithDifferentPackageBaseClass.ProtectedInterfaceSealedClass.SecondObject -> + is + ProtectedInterfaceOuterClassWithDifferentPackageBaseClass.ProtectedInterfaceSealedClass.SecondObject -> "ProtectedInterfaceOuterClassWithDifferentPackageBaseClass_ProtectedInterfaceSealedClass_SecondObject" } @@ -123,9 +127,11 @@ public object fun sealedObjectToEnum(obj: ProtectedInterfaceOuterClassWithDifferentPackageBaseClass.ProtectedInterfaceSealedClass): ProtectedInterfaceOuterClassWithDifferentPackageBaseClass_ProtectedInterfaceSealedClassEnum = when (obj) { - ProtectedInterfaceOuterClassWithDifferentPackageBaseClass.ProtectedInterfaceSealedClass.FirstObject -> + is + ProtectedInterfaceOuterClassWithDifferentPackageBaseClass.ProtectedInterfaceSealedClass.FirstObject -> ProtectedInterfaceOuterClassWithDifferentPackageBaseClass_ProtectedInterfaceSealedClassEnum.ProtectedInterfaceOuterClassWithDifferentPackageBaseClass_ProtectedInterfaceSealedClass_FirstObject - ProtectedInterfaceOuterClassWithDifferentPackageBaseClass.ProtectedInterfaceSealedClass.SecondObject -> + is + ProtectedInterfaceOuterClassWithDifferentPackageBaseClass.ProtectedInterfaceSealedClass.SecondObject -> ProtectedInterfaceOuterClassWithDifferentPackageBaseClass_ProtectedInterfaceSealedClassEnum.ProtectedInterfaceOuterClassWithDifferentPackageBaseClass_ProtectedInterfaceSealedClass_SecondObject } diff --git a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/visibility/VisibilitySealedClass.kt b/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/visibility/VisibilitySealedClass.kt index bef0670c..5f1aebff 100644 --- a/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/visibility/VisibilitySealedClass.kt +++ b/processing-tests/common/test/kotlin/com/livefront/sealedenum/compilation/visibility/VisibilitySealedClass.kt @@ -66,15 +66,15 @@ public object InternalObjectsSealedClassSealedEnum : SealedEnum 0 - InternalObjectsSealedClass.SecondObject -> 1 - InternalObjectsSealedClass.InnerSealedClass.ThirdObject -> 2 + is InternalObjectsSealedClass.FirstObject -> 0 + is InternalObjectsSealedClass.SecondObject -> 1 + is InternalObjectsSealedClass.InnerSealedClass.ThirdObject -> 2 } public override fun nameOf(obj: InternalObjectsSealedClass): String = when (obj) { - InternalObjectsSealedClass.FirstObject -> "InternalObjectsSealedClass_FirstObject" - InternalObjectsSealedClass.SecondObject -> "InternalObjectsSealedClass_SecondObject" - InternalObjectsSealedClass.InnerSealedClass.ThirdObject -> + is InternalObjectsSealedClass.FirstObject -> "InternalObjectsSealedClass_FirstObject" + is InternalObjectsSealedClass.SecondObject -> "InternalObjectsSealedClass_SecondObject" + is InternalObjectsSealedClass.InnerSealedClass.ThirdObject -> "InternalObjectsSealedClass_InnerSealedClass_ThirdObject" } @@ -88,11 +88,11 @@ public object InternalObjectsSealedClassSealedEnum : SealedEnum + is InternalObjectsSealedClass.FirstObject -> InternalObjectsSealedClassEnum.InternalObjectsSealedClass_FirstObject - InternalObjectsSealedClass.SecondObject -> + is InternalObjectsSealedClass.SecondObject -> InternalObjectsSealedClassEnum.InternalObjectsSealedClass_SecondObject - InternalObjectsSealedClass.InnerSealedClass.ThirdObject -> + is InternalObjectsSealedClass.InnerSealedClass.ThirdObject -> InternalObjectsSealedClassEnum.InternalObjectsSealedClass_InnerSealedClass_ThirdObject } @@ -199,13 +199,13 @@ internal object InternalSealedClassSealedEnum : SealedEnum, get() = InternalSealedClassEnum::class public override fun ordinalOf(obj: InternalSealedClass): Int = when (obj) { - InternalSealedClass.FirstObject -> 0 - InternalSealedClass.SecondObject -> 1 + is InternalSealedClass.FirstObject -> 0 + is InternalSealedClass.SecondObject -> 1 } public override fun nameOf(obj: InternalSealedClass): String = when (obj) { - InternalSealedClass.FirstObject -> "InternalSealedClass_FirstObject" - InternalSealedClass.SecondObject -> "InternalSealedClass_SecondObject" + is InternalSealedClass.FirstObject -> "InternalSealedClass_FirstObject" + is InternalSealedClass.SecondObject -> "InternalSealedClass_SecondObject" } public override fun valueOf(name: String): InternalSealedClass = when (name) { @@ -216,8 +216,10 @@ internal object InternalSealedClassSealedEnum : SealedEnum, public override fun sealedObjectToEnum(obj: InternalSealedClass): InternalSealedClassEnum = when (obj) { - InternalSealedClass.FirstObject -> InternalSealedClassEnum.InternalSealedClass_FirstObject - InternalSealedClass.SecondObject -> InternalSealedClassEnum.InternalSealedClass_SecondObject + is InternalSealedClass.FirstObject -> + InternalSealedClassEnum.InternalSealedClass_FirstObject + is InternalSealedClass.SecondObject -> + InternalSealedClassEnum.InternalSealedClass_SecondObject } public override fun enumToSealedObject(`enum`: InternalSealedClassEnum): InternalSealedClass = @@ -319,13 +321,13 @@ public object InternalCompanionSealedClassSealedEnum : SealedEnum 0 - InternalCompanionSealedClass.SecondObject -> 1 + is InternalCompanionSealedClass.FirstObject -> 0 + is InternalCompanionSealedClass.SecondObject -> 1 } public override fun nameOf(obj: InternalCompanionSealedClass): String = when (obj) { - InternalCompanionSealedClass.FirstObject -> "InternalCompanionSealedClass_FirstObject" - InternalCompanionSealedClass.SecondObject -> "InternalCompanionSealedClass_SecondObject" + is InternalCompanionSealedClass.FirstObject -> "InternalCompanionSealedClass_FirstObject" + is InternalCompanionSealedClass.SecondObject -> "InternalCompanionSealedClass_SecondObject" } public override fun valueOf(name: String): InternalCompanionSealedClass = when (name) { @@ -336,9 +338,9 @@ public object InternalCompanionSealedClassSealedEnum : SealedEnum + is InternalCompanionSealedClass.FirstObject -> InternalCompanionSealedClassEnum.InternalCompanionSealedClass_FirstObject - InternalCompanionSealedClass.SecondObject -> + is InternalCompanionSealedClass.SecondObject -> InternalCompanionSealedClassEnum.InternalCompanionSealedClass_SecondObject } @@ -447,14 +449,14 @@ internal object InternalSealedAndCompanionSealedClassSealedEnum : get() = InternalSealedAndCompanionSealedClassEnum::class public override fun ordinalOf(obj: InternalSealedAndCompanionSealedClass): Int = when (obj) { - InternalSealedAndCompanionSealedClass.FirstObject -> 0 - InternalSealedAndCompanionSealedClass.SecondObject -> 1 + is InternalSealedAndCompanionSealedClass.FirstObject -> 0 + is InternalSealedAndCompanionSealedClass.SecondObject -> 1 } public override fun nameOf(obj: InternalSealedAndCompanionSealedClass): String = when (obj) { - InternalSealedAndCompanionSealedClass.FirstObject -> + is InternalSealedAndCompanionSealedClass.FirstObject -> "InternalSealedAndCompanionSealedClass_FirstObject" - InternalSealedAndCompanionSealedClass.SecondObject -> + is InternalSealedAndCompanionSealedClass.SecondObject -> "InternalSealedAndCompanionSealedClass_SecondObject" } @@ -468,9 +470,9 @@ internal object InternalSealedAndCompanionSealedClassSealedEnum : public override fun sealedObjectToEnum(obj: InternalSealedAndCompanionSealedClass): InternalSealedAndCompanionSealedClassEnum = when (obj) { - InternalSealedAndCompanionSealedClass.FirstObject -> + is InternalSealedAndCompanionSealedClass.FirstObject -> InternalSealedAndCompanionSealedClassEnum.InternalSealedAndCompanionSealedClass_FirstObject - InternalSealedAndCompanionSealedClass.SecondObject -> + is InternalSealedAndCompanionSealedClass.SecondObject -> InternalSealedAndCompanionSealedClassEnum.InternalSealedAndCompanionSealedClass_SecondObject } diff --git a/processing-tests/processor-tests/src/test/kotlin/com/livefront/sealedenum/compilation/kitchensink/JavaBaseClasses.kt b/processing-tests/processor-tests/src/test/kotlin/com/livefront/sealedenum/compilation/kitchensink/JavaBaseClasses.kt index 9d7ba7e4..310b5046 100644 --- a/processing-tests/processor-tests/src/test/kotlin/com/livefront/sealedenum/compilation/kitchensink/JavaBaseClasses.kt +++ b/processing-tests/processor-tests/src/test/kotlin/com/livefront/sealedenum/compilation/kitchensink/JavaBaseClasses.kt @@ -95,13 +95,13 @@ public object JavaBaseClassesSealedClassSealedEnum : SealedEnum): Int = when (obj) { - JavaBaseClassesSealedClass.FirstObject -> 0 - JavaBaseClassesSealedClass.SecondObject -> 1 + is JavaBaseClassesSealedClass.FirstObject -> 0 + is JavaBaseClassesSealedClass.SecondObject -> 1 } public override fun nameOf(obj: JavaBaseClassesSealedClass<*>): String = when (obj) { - JavaBaseClassesSealedClass.FirstObject -> "JavaBaseClassesSealedClass_FirstObject" - JavaBaseClassesSealedClass.SecondObject -> "JavaBaseClassesSealedClass_SecondObject" + is JavaBaseClassesSealedClass.FirstObject -> "JavaBaseClassesSealedClass_FirstObject" + is JavaBaseClassesSealedClass.SecondObject -> "JavaBaseClassesSealedClass_SecondObject" } public override fun valueOf(name: String): JavaBaseClassesSealedClass<*> = when (name) { @@ -112,9 +112,9 @@ public object JavaBaseClassesSealedClassSealedEnum : SealedEnum): JavaBaseClassesSealedClassEnum = when (obj) { - JavaBaseClassesSealedClass.FirstObject -> + is JavaBaseClassesSealedClass.FirstObject -> JavaBaseClassesSealedClassEnum.JavaBaseClassesSealedClass_FirstObject - JavaBaseClassesSealedClass.SecondObject -> + is JavaBaseClassesSealedClass.SecondObject -> JavaBaseClassesSealedClassEnum.JavaBaseClassesSealedClass_SecondObject } diff --git a/runtime/src/main/kotlin/com/livefront/sealedenum/GenSealedEnum.kt b/runtime/src/main/kotlin/com/livefront/sealedenum/GenSealedEnum.kt index 6a4d55fd..d7b8ce74 100644 --- a/runtime/src/main/kotlin/com/livefront/sealedenum/GenSealedEnum.kt +++ b/runtime/src/main/kotlin/com/livefront/sealedenum/GenSealedEnum.kt @@ -23,13 +23,13 @@ package com.livefront.sealedenum * ) * * override fun ordinalOf(obj: Alpha): Int = when (obj) { - * Alpha.Beta -> 0 - * Alpha.Gamma -> 1 + * is Alpha.Beta -> 0 + * is Alpha.Gamma -> 1 * } * * override fun nameOf(obj: AlphaSealedEnum): String = when (obj) { - * Alpha.Beta -> "Alpha_Beta" - * Alpha.Gamma -> "Alpha_Gamma" + * is Alpha.Beta -> "Alpha_Beta" + * is Alpha.Gamma -> "Alpha_Gamma" * } * * override fun valueOf(name: String): AlphaSealedEnum = when (name) { @@ -96,15 +96,15 @@ package com.livefront.sealedenum * ) * * override fun ordinalOf(obj: Alpha): Int = when (obj) { - * Alpha.Delta -> 0 - * Alpha.Beta.Gamma -> 1 - * Alpha.Epsilon.Zeta -> 2 + * is Alpha.Delta -> 0 + * is Alpha.Beta.Gamma -> 1 + * is Alpha.Epsilon.Zeta -> 2 * } * * override fun nameOf(obj: AlphaLevelOrderSealedEnum): String = when (obj) { - * Alpha.Delta -> "Alpha_Delta" - * Alpha.Beta.Gamma -> "Alpha_Beta_Gamma" - * Alpha.Epsilon.Zeta -> "Alpha_Epsilon_Zeta" + * is Alpha.Delta -> "Alpha_Delta" + * is Alpha.Beta.Gamma -> "Alpha_Beta_Gamma" + * is Alpha.Epsilon.Zeta -> "Alpha_Epsilon_Zeta" * } * * override fun valueOf(name: String): AlphaLevelOrderSealedEnum = when (name) { @@ -123,15 +123,15 @@ package com.livefront.sealedenum * ) * * override fun ordinalOf(obj: Alpha): Int = when (obj) { - * Alpha.Beta.Gamma -> 0 - * Alpha.Delta -> 1 - * Alpha.Epsilon.Zeta -> 2 + * is Alpha.Beta.Gamma -> 0 + * is Alpha.Delta -> 1 + * is Alpha.Epsilon.Zeta -> 2 * } * * override fun nameOf(obj: AlphaInOrderSealedEnum): String = when (obj) { - * Alpha.Beta.Gamma -> "Alpha_Beta_Gamma" - * Alpha.Delta -> "Alpha_Delta" - * Alpha.Epsilon.Zeta -> "Alpha_Epsilon_Zeta" + * is Alpha.Beta.Gamma -> "Alpha_Beta_Gamma" + * is Alpha.Delta -> "Alpha_Delta" + * is Alpha.Epsilon.Zeta -> "Alpha_Epsilon_Zeta" * } * * override fun valueOf(name: String): AlphaInOrderSealedEnum = when (name) {