Hi Can you help me? I have this code in common `e...
# kotlin-native
c
Hi Can you help me? I have this code in common
expect class ContextRef
then I try implement this code for linux_x64:
actual typealias ContextRef = LLVMContextRef
in this case i got error because
LLVMContextRef
is alias:
public typealias LLVMContextRef = kotlinx.cinterop.CPointer<cnames.structs.LLVMOpaqueContext>
okey, it is fine, I forgot about that thing. I try to change my code to
actual typealias ContextRef = kotlinx.cinterop.CPointer<cnames.structs.LLVMOpaqueContext>
And i got suddenly error:
Type arguments in the right-hand side of actual type alias should be its type parameters in the same order, e.g. 'actual typealias Foo<A, B> = Bar<A, B>'
Why it happend? Why it work fine without
expect
and
actual
? How I can fix it?
kotlinx-coroutines-test made some magic: in common:
public expect class TestResult
in js
public actual typealias TestResult = Promise<Unit>
(it is my case) in other (jvm and native):
public actual typealias TestResult = Unit
. How it work?
TestResult
should be
class
, but
Unit
- it is
object
I found. like this:
Copy code
@Suppress("NO_ACTUAL_FOR_EXPECT")
expect class LLVMContextRef
@Suppress("ACTUAL_WITHOUT_EXPECT", "ACTUAL_TYPE_ALIAS_WITH_COMPLEX_SUBSTITUTION")
actual typealias LLVMContextRef = CPointer<cnames.structs.LLVMOpaqueContext>