Tristan
02/26/2022, 2:25 AM./gradlew linkNative
) I get an error when I return null
in a function, such as:
// commonMain
interface GetManufacturerUseCase {
operator fun invoke(): String?
}
// nativeMain
class GetManufacturerUseCaseImpl : GetManufacturerUseCase {
override fun invoke() = null
}
It produces this error
/var/folders/v4/tsnbm2mj12qcqd5mzx022z0m0000gp/T/konan_temp15915856283221827637/api.cpp:482:21: error: unknown type name 'libNative_kref_kotlin_Nothing'; did you mean 'libNative_kref_kotlin_Long'?
libNative_kref_kotlin_Nothing (*invoke)(libNative_kref_com_me_myproject_deviceInfo_domain_usecase_GetManufacturerUseCaseImpl thiz);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
libNative_kref_kotlin_Long
To fix it, I return an empty string đŸ˜• But that’s not really what I want.
Is this a bug, or a limitation?ephemient
02/26/2022, 2:33 AMoverride fun invoke(): String? = null
? the null
is inferred to be Nothing?
if not given a narrower type, and it seems that isn't interoperableTristan
02/28/2022, 7:54 PM