utopia-rise / godot-kotlin-jvm

Godot Kotlin JVM Module
MIT License
560 stars 38 forks source link

[Kotlin 2.0] Fix `Variant::toGodot` call after KT-68339 is fixed #643

Open chippmann opened 1 month ago

chippmann commented 1 month ago

In Kotlin 2.0 there is a bug with enum initialization order which gives false positives in our Variant::toGodot call. See: https://youtrack.jetbrains.com/issue/KT-68339

After https://youtrack.jetbrains.com/issue/KT-68339 is fixed, we need to undo the corresponding change made in https://github.com/utopia-rise/godot-kotlin-jvm/pull/641

CedNaru commented 1 month ago

I'll add that we can use the opportunity to rework the whole Variant.kt file. This is way more complex than it should be. We created it when we weren't sure of how Godot was behaving. For example, we check the null value for everything variant type, when it can only happen for the OBJECT type. We also have things like those composite types (JVM_INT) that are not part of the original Godot variant and at the time were used by the API gen, which is no longer necessary now that it handles the casting itself (we will probably require changes in the entry gen)