Skip to content

Cannot find protocol declaration for SharedCodeKotlinCoroutineContextElement #1303

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
NilsLattek opened this issue Jun 28, 2019 · 4 comments
Closed
Labels

Comments

@NilsLattek
Copy link

Kotlin: 1.3.40
Coroutines: 1.2.2
Gradle: 5.4.1

After upgrading Kotlin and coroutines we receive the following error in Xcode for our ios build:

__attribute__((swift_name("KotlinCoroutineContext")))
@protocol SharedCodeKotlinCoroutineContext
@required
- (id _Nullable)foldInitial:(id _Nullable)initial operation:(id _Nullable (^)(id _Nullable, id<SharedCodeKotlinCoroutineContextElement>))operation __attribute__((swift_name("fold(initial:operation:)")));
- (id<SharedCodeKotlinCoroutineContextElement> _Nullable)getKey:(id<SharedCodeKotlinCoroutineContextKey>)key __attribute__((swift_name("get(key:)")));
- (id<SharedCodeKotlinCoroutineContext>)minusKeyKey:(id<SharedCodeKotlinCoroutineContextKey>)key __attribute__((swift_name("minusKey(key:)")));
- (id<SharedCodeKotlinCoroutineContext>)plusContext:(id<SharedCodeKotlinCoroutineContext>)context __attribute__((swift_name("plus(context:)")));
@end;

Cannot find protocol declaration for 'SharedCodeKotlinCoroutineContextElement'; did you mean 'SharedCodeKotlinCoroutineContextKey'?

@maxspencer
Copy link

I have the same issue.

Because there's a circular dependency between KotlinCoroutineContext and KotlinCoroutineContextElement there needs to be a forward declaration of the KotlinCoroutineContextElement at the top of the header file, like:

@protocol SharedCodeKotlinCoroutineContextElement;

I found in my headerfile there were already some similar forward declarations which suggests this is something that's been considered, but for whatever reason is not working in this specific instance.

I found that manually editting the header file could resolve the problem, but this isn't a viable solution.

@Pomis
Copy link

Pomis commented Jun 28, 2019

Having the same problem
Versions are the same
Kotlin: 1.3.40
Coroutines: 1.2.2
Gradle: 5.4.1

@Cilestal
Copy link

Having the same problem
Gradle wrapper: 5.4.1
Kotlin: 1.3.40
Coroutines: 1.3.0-M2

@qwwdfsad
Copy link
Member

qwwdfsad commented Jun 28, 2019

This is a regression in Kotlin Native 1.3.40.
It's already fixed in upcoming 1.3.41.

Will keep it open until release with 1.3.41.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants