-
Notifications
You must be signed in to change notification settings - Fork 37
Open
Description
Steps:
1 . Enable k2Mode in Gradle plugin.
nativeCoroutines {
suffix = "Platform"
k2Mode = true
}
- Add the next code:
import com.rickclephas.kmp.nativecoroutines.NativeCoroutines
interface Base1 {
@NativeCoroutines
suspend fun foo()
}
interface Base2 {
@NativeCoroutines
suspend fun foo()
}
class Derived1: Base1 {
@NativeCoroutines
override suspend fun foo() { println("Derived1") }
}
class Derived2: Base2, Base1 by Derived1() {
@NativeCoroutines
override suspend fun foo() { println("Derived2") }
}
- Run
./gradlew podPublishDebugXCFramework
Expected: compilation successful
Actual: compilation error
Cannot infer visibility for 'fooPlatform'. Please specify it explicitly.
Class 'Derived2' must override 'fooPlatform' because it inherits multiple interface methods for it.
Note:
If we want to generate Native coroutine overload only to one interface, we get an another error.
interface Base1 {
@NativeCoroutines
suspend fun foo()
}
interface Base2 {
suspend fun foo()
}
class Derived1: Base1 {
@NativeCoroutines
override suspend fun foo() {}
}
class Derived2: Base2, Base1 by Derived1() {
override suspend fun foo() {}
}
Error:
Refined declaration 'suspend fun foo(): Unit' overrides declarations with different or no refinement from:
interface Base2 : Any
Metadata
Metadata
Assignees
Labels
No labels