Const and inline classes

I would like to propose that const properties type restrictions are made more flexible to allow inline classes that wrap String or primitive type as well.

inline class MessageType(val id: Int) {
    companion object {
        const val Retransmission_Request = MessageType(0)
    }
}

This isn’t allowed currently. I wonder if you think it makes sense to allow this, as the runtime type of this field should be Int.
It would’ve been my temporary workaround for inline enum classes not yet being allowed (I am not on top of the discussion regarding this at the moment).

4 Likes

Please follow https://youtrack.jetbrains.com/issue/KT-25915

1 Like

Sorry, and thanks!