Daniel Souza Bertoldi
03/11/2026, 5:31 PMDaniel Souza Bertoldi
03/11/2026, 5:32 PMclass Greeting {
fun test(): String = "Test"
fun type(): GreetingType = GreetingType.whats_UP
}
enum class GreetingType {
HI,
hello,
whats_UP,
Hey;
}
And try to fetch a GreetingType by calling type(), the app crashes. It doesn't matter what enum class value I'm returning, the crash always happens. __externalRCRefUnsafe in the generated Shared.swift file has a memory address that does not represent any of the memory addresses for the other enum class values, throwing a fatalError() (check screenshot)
If I initialize a variable directly by referencing a enum class value then the crash doesn't happen: val a = <http://org.example.com|org.example.com>.GreetingType.HI
This only happens when I try to get the value from a function.
I created a really small repro using KMP Wizard, here's the link.
Am I missing something here? I'm not sure if there's an actual bug or I'm just doing something silly which in turn causes the bug.Daniel Souza Bertoldi
03/11/2026, 5:34 PMArtem Olkov
03/11/2026, 9:29 PM