Your function works if you specify the type parameter value explicitly:
val value = safeValueOf<TestEnum>("test")
The original code is supposed to work as well, but doesn’t work because of a bug in the type inference implementation: https://youtrack.jetbrains.com/issue/KT-11218