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
dmitriy.novozhilov
10/28/2020, 7:15 AM
cc @ilya.gorbunov
d
David
10/30/2020, 3:09 PM
?
i
ilya.gorbunov
11/08/2020, 4:45 PM
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