Describe the bug
In some cases, equals of SerialDesciptor can't be reversed.
To Reproduce
If you run the code, the second test fails. If you change the type of a in both classes to C and run the code, the both tests pass.
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import kotlin.test.Test
import kotlin.test.assertNotEquals
@Serializable
data class ClassWithEnum1(val a: A?)
@Serializable
@SerialName("ClassWithEnum1")
data class ClassWithEnum2(val a: A)
@Serializable
enum class A {
B,
}
@Serializable
enum class C {
D,
}
class TestEquals {
@Test
fun test() {
assertNotEquals(ClassWithEnum1.serializer().descriptor, ClassWithEnum2.serializer().descriptor)
}
@Test
fun testReversed() {
assertNotEquals(ClassWithEnum2.serializer().descriptor, ClassWithEnum1.serializer().descriptor)
}
}
Expected behavior
I think the test shouldn't crash.
Environment
If we compare generated bytecode of C and A, we receive different serializers...

It seems like a funny compiler plugin bug: it assumes that C means Char (since C, indeed, is code name for char primitive in JVM bytecode) and inserts char serializer
Workaround: don't use name C (rename your enum value with @SerialName into something else)
Most helpful comment
It seems like a funny compiler plugin bug: it assumes that
CmeansChar(since C, indeed, is code name for char primitive in JVM bytecode) and inserts char serializerWorkaround: don't use name
C(rename your enum value with@SerialNameinto something else)