I’m trying to include Coroutines 1.3.0-M1 with Kot...
# kotlin-native
t
I’m trying to include Coroutines 1.3.0-M1 with Kotlin 1.3.40 in my project. Coroutines 1.3.0-M1 is not based on 1.3.40 so I need to build it manually. I successfully built coroutines and published it to maven local. However, the generated objective C framework has the following error (my module is named common):
Copy code
Cannot find protocol declaration for 'CommonKotlinCoroutineContextElement'; did you mean 'CommonKotlinCoroutineContextKey'?
This is the part where it shows the error:
Copy code
__attribute__((swift_name("KotlinCoroutineContext")))
@protocol CommonKotlinCoroutineContext
@required
- (id _Nullable)foldInitial:(id _Nullable)initial operation:(id _Nullable (^)(id _Nullable, id<CommonKotlinCoroutineContextElement>))operation __attribute__((swift_name("fold(initial:operation:)")));
- (id<CommonKotlinCoroutineContextElement> _Nullable)getKey:(id<CommonKotlinCoroutineContextKey>)key __attribute__((swift_name("get(key:)")));
- (id<CommonKotlinCoroutineContext>)minusKeyKey:(id<CommonKotlinCoroutineContextKey>)key __attribute__((swift_name("minusKey(key:)")));
- (id<CommonKotlinCoroutineContext>)plusContext:(id<CommonKotlinCoroutineContext>)context __attribute__((swift_name("plus(context:)")));
@end;
Could anyone here point me in the right direction what could be wrong?
e
Use version
1.2.2
. The updated 1.3.0 milestone will come a bit later.
👍 2
t
Great, that will work for now. Thank you!
@elizarov I tried version
1.2.2
but unfortunately that gives the same error
e
Seems like K/N bug to me 😞
s
Thanks, confirmed.
👍 2
Adding
Copy code
class Workaround {
    fun workaround(element: kotlin.coroutines.CoroutineContext.Element) {}
}
to your Kotlin code may help to workaround the issue. Does it?
(to be added preferably to root package)
t
@svyatoslav.scherbina Can confirm the workaround works, but only if it is added to the root package. It is really amazing how quickly you fix the issues!
s
It would be even more amazing if we didn’t make the issues 🙂
😀 3
r
I can also confirm the workaround worked for me. Is there an issue somewhere we can track to see when this is fixed and we can remove the workaround @svyatoslav.scherbina?
s
The issue is already fixed: https://github.com/JetBrains/kotlin-native/pull/3088 The fix will be delivered within the nearest release.
r
Thanks