Evening, I stumbled accross issue KT-42619 (<http...
# kontributors
d
Evening, I stumbled accross issue KT-42619 (https://youtrack.jetbrains.com/issue/KT-42619) , the request for a nullable valueOf method for Enums. Now, I thought, let's contribute and try to create a pull request for this seemingly simple function. Checked out Kotlin, and started checking where I could add this function .... It seems that it is far less straightforward then I thought. Where should I start if I wish to add a function to Enums ?
d
cc @ilya.gorbunov
d
?
i
Hi @David, Indeed these functions are only seemingly simple. In fact they are implemented as compiler intrinsics and require special treatment in every backend of Kotlin compiler: JVM, JS, Native, JS-IR, JVM-IR. Unfortunately, I can't give you many pointers on these implementations other than full text search in the compiler code base would reveal. You can take a look at the implementation of the similar functions
enumValues<T>
and
enumValueOf<T>
in this issue https://youtrack.jetbrains.com/issue/KT-10569 and the commits and issues related to it.
d
Thank you, I will see what I can learn from it