ankushg
08/01/2018, 2:55 AManton.bannykh
08/01/2018, 2:43 PMankushg
08/01/2018, 2:55 PMankushg
08/01/2018, 2:58 PManton.bannykh
08/01/2018, 3:26 PManton.bannykh
08/01/2018, 3:27 PM// common
expect class MyEnumProxy
expect fun MyEnumProxy.resolve(): MyEum
enum class MyEnum {
A, B
}
// JVM
actual typealias MyEnumProxy = MyEnum
actual inline fun MyEnumProxy.resolve() = this
// JS
actual typealias MyEnumProxy = String
actual fun MyEnumProxy.resolve() = MyEnum.valueOf(this)
anton.bannykh
08/01/2018, 3:30 PMankushg
08/01/2018, 3:35 PMankushg
08/01/2018, 3:48 PMexpect class
in combination with actual enum class
(or a typealias to one) -- the compiler marks the declarations as incompatible because the class kinds are different 😞anton.bannykh
08/01/2018, 3:52 PMactual inline class
could work?ankushg
08/01/2018, 5:20 PMactual inline class
without expect inline class
, and if I expect inline class
, I need to provide the constructor in common code. This means that I can't use String
in JS while using MyEnum
in the JVMankushg
08/01/2018, 5:21 PMinline enum class
-- that at least sounds like what I'm trying to do 🙂anton.bannykh
08/02/2018, 10:04 AMankushg
08/02/2018, 4:00 PM