darkmoon_uk
03/26/2025, 2:28 AMtapchicoma
03/26/2025, 9:55 AMPavel Kunyavskiy [JB]
03/26/2025, 11:15 AM.entries
used in common code (becuase it didn't work in 1.9 either).
• In 1.9 it worked accidentially, because check was lost (but example above shows it's needed).
• In 2.0 it was changed within other fixes in multiplatform made more strict (as now common code is compilated separately, and all this problems arised).
• Now you can't actualize typealias to interop class, as it doesn't match (which is correct), and need to workaround it by some strange hacks?darkmoon_uk
03/26/2025, 10:07 PMexpect enum class
and actual
-ising it with an Obj-C Enum.
The number and identities of the enum members is not significant, only the substitution of the enum
type.
I also don't make explicit use of .entries
as you mentioned.
To add some context; one of my use cases is to commonise a decimal RoundingMode
between the distinct rounding-mode enums that accompany each of JVM BigDecimal and iOS NSDecimalNumber.
Why would it be 'not correct' to actual typealias
to an interop class - as long as that has equivalent modality, which an ObjC enum does?
I assume you mean 'not correct' according to the world-view of the current implementation, since there should be no conceptual problem with this: its just 'yet another' type substitution - unless I'm missing something?
All seemed consistent and functional in 1.9
even if 'by accident'.
I refactored my code to work around it but the code is not as elegant.
As things stand now in 2.x you can't use expect
/ actual
with enum classes if you have a Kotlin/Native target, which can be seen as a significant Multiplatform language limitation introduced in 2.x - in practice if not intent.
Do you see a pathway to re-enabling this?Pavel Kunyavskiy [JB]
03/27/2025, 7:47 AM.entries
on expect enum, and it would break.
It's not the case for now, but we are actively working on common modules of dependees being resolved to dependency common part. And after this it would be broken even more.
I would say it definitely should be supported, but not by lifting the restriction, but by adding .entries
to interop enums, which should be doable.darkmoon_uk
03/27/2025, 7:49 AMdarkmoon_uk
03/27/2025, 7:50 AM.entries
to interop enum sounds right, to complete the general contract of an enum.darkmoon_uk
03/27/2025, 7:50 AMPavel Kunyavskiy [JB]
03/27/2025, 7:50 AM