GithubHelp home page GithubHelp logo

rickclephas / kmp-nativecoroutines Goto Github PK

View Code? Open in Web Editor NEW
1.0K 17.0 32.0 1.63 MB

Library to use Kotlin Coroutines from Swift code in KMP apps

License: MIT License

Kotlin 82.41% Swift 14.22% Ruby 0.91% Java 2.47%
ios kotlin swift kotlin-coroutines kotlin-multiplatform combine kotlin-multiplatform-mobile kmp kmm macos

kmp-nativecoroutines's Introduction

KMP-NativeCoroutines

A library to use Kotlin Coroutines from Swift code in KMP apps.

Why this library?

Both KMP and Kotlin Coroutines are amazing, but together they have some limitations.

The most important limitation is cancellation support.
Kotlin suspend functions are exposed to Swift as functions with a completion handler.
This allows you to easily use them from your Swift code, but it doesn't support cancellation.

Note

While Swift 5.5 brings async functions to Swift, it doesn't solve this issue.
For interoperability with ObjC all functions with a completion handler can be called like an async function.
This means starting with Swift 5.5 your Kotlin suspend functions will look like Swift async functions.
But that's just syntactic sugar, so there's still no cancellation support.

Besides cancellation support, ObjC doesn't support generics on protocols.
So all the Flow interfaces lose their generic value type which make them hard to use.

This library solves both of these limitations ๐Ÿ˜„.

Compatibility

The latest version of the library uses Kotlin version 2.0.0.
Compatibility versions for older and/or preview Kotlin versions are also available:

Version Version suffix Kotlin KSP Coroutines
latest -kotlin-2.0.20-Beta2 2.0.20-Beta2 1.0.23 1.9.0-RC
latest -kotlin-2.0.10-RC 2.0.10-RC 1.0.23 1.9.0-RC
latest no suffix 2.0.0 1.0.23 1.8.1
1.0.0-ALPHA-30 no suffix 1.9.24 1.0.20 1.8.1
1.0.0-ALPHA-28 no suffix 1.9.23 1.0.20 1.8.0
1.0.0-ALPHA-25 no suffix 1.9.22 1.0.17 1.8.0
1.0.0-ALPHA-23 no suffix 1.9.21 1.0.16 1.7.3
1.0.0-ALPHA-21 no suffix 1.9.20 1.0.14 1.7.3
1.0.0-ALPHA-18 no suffix 1.9.10 1.0.13 1.7.3
1.0.0-ALPHA-17 no suffix 1.9.0 1.0.12 1.7.3
1.0.0-ALPHA-12 no suffix 1.8.22 1.0.11 1.7.2
1.0.0-ALPHA-10 no suffix 1.8.21 1.0.11 1.7.1
1.0.0-ALPHA-7 no suffix 1.8.20 1.0.10 1.6.4

You can choose from a couple of Swift implementations.
Depending on the implementation you can support as low as iOS 9, macOS 10.9, tvOS 9 and watchOS 3:

Implementation Swift iOS macOS tvOS watchOS
Async 5.5 13.0 10.15 13.0 6.0
Combine 5.0 13.0 10.15 13.0 6.0
RxSwift 5.0 9.0 10.9 9.0 3.0

Installation

The library consists of a Kotlin and Swift part which you'll need to add to your project.
The Kotlin part is available on Maven Central and the Swift part can be installed via CocoaPods or the Swift Package Manager.

Make sure to always use the same versions for all the libraries!

Kotlin

For Kotlin just add the plugin to your build.gradle.kts:

plugins {
    id("com.google.devtools.ksp") version "2.0.0-1.0.23"
    id("com.rickclephas.kmp.nativecoroutines") version "1.0.0-ALPHA-32"
}

and make sure to opt in to the experimental @ObjCName annotation:

kotlin.sourceSets.all {
    languageSettings.optIn("kotlin.experimental.ExperimentalObjCName")
}

Swift (Swift Package Manager)

The Swift implementations are available via the Swift Package Manager.
Just add it to your Package.swift file:

dependencies: [
    .package(url: "https://github.com/rickclephas/KMP-NativeCoroutines.git", exact: "1.0.0-ALPHA-32")
],
targets: [
    .target(
        name: "MyTargetName",
        dependencies: [
            // Swift Concurrency implementation
            .product(name: "KMPNativeCoroutinesAsync", package: "KMP-NativeCoroutines"),
            // Combine implementation
            .product(name: "KMPNativeCoroutinesCombine", package: "KMP-NativeCoroutines"),
            // RxSwift implementation
            .product(name: "KMPNativeCoroutinesRxSwift", package: "KMP-NativeCoroutines")
        ]
    )
]

Or add it in Xcode by going to File > Add Packages... and providing the URL: https://github.com/rickclephas/KMP-NativeCoroutines.git.

Note

The version for the Swift package should not contain the Kotlin version suffix (e.g. -new-mm or -kotlin-1.6.0).

Note

If you only need a single implementation you can also use the SPM specific versions with suffixes -spm-async, -spm-combine and -spm-rxswift.

Swift (CocoaPods)

If you use CocoaPods add one or more of the following libraries to your Podfile:

pod 'KMPNativeCoroutinesAsync', '1.0.0-ALPHA-32'    # Swift Concurrency implementation
pod 'KMPNativeCoroutinesCombine', '1.0.0-ALPHA-32'  # Combine implementation
pod 'KMPNativeCoroutinesRxSwift', '1.0.0-ALPHA-32'  # RxSwift implementation

Note

The version for CocoaPods should not contain the Kotlin version suffix (e.g. -new-mm or -kotlin-1.6.0).

IntelliJ / Android Studio

Install the IDE plugin from the JetBrains Marketplace to get:

  • Annotation usage validation
  • Exposed coroutines warnings
  • Quick fixes to add annotations

Usage

Using your Kotlin Coroutines code from Swift is almost as easy as calling the Kotlin code.
Just use the wrapper functions in Swift to get async functions, AsyncStreams, Publishers or Observables.

Kotlin

The plugin will automagically generate the necessary code for you! ๐Ÿ”ฎ
Just annotate your coroutines declarations with @NativeCoroutines (or @NativeCoroutinesState).

Flows

Your Flow properties/functions get a native version:

import com.rickclephas.kmp.nativecoroutines.NativeCoroutines

class Clock {
    // Somewhere in your Kotlin code you define a Flow property
    // and annotate it with @NativeCoroutines
    @NativeCoroutines
    val time: StateFlow<Long> // This can be any kind of Flow
}
Generated code

The plugin will generate this native property for you:

import com.rickclephas.kmp.nativecoroutines.asNativeFlow
import kotlin.native.ObjCName

@ObjCName(name = "time")
val Clock.timeNative
    get() = time.asNativeFlow()

For the StateFlow defined above the plugin will also generate this value property:

val Clock.timeValue
    get() = time.value

In case of a SharedFlow the plugin would generate a replay cache property:

val Clock.timeReplayCache
    get() = time.replayCache

StateFlows

Using StateFlow properties to track state (like in a view model)?
Use the @NativeCoroutinesState annotation instead:

import com.rickclephas.kmp.nativecoroutines.NativeCoroutinesState

class Clock {
    // Somewhere in your Kotlin code you define a StateFlow property
    // and annotate it with @NativeCoroutinesState
    @NativeCoroutinesState
    val time: StateFlow<Long> // This must be a StateFlow
}
Generated code

The plugin will generate these native properties for you:

import com.rickclephas.kmp.nativecoroutines.asNativeFlow
import kotlin.native.ObjCName

@ObjCName(name = "time")
val Clock.timeValue
    get() = time.value

val Clock.timeFlow
    get() = time.asNativeFlow()

Suspend functions

The plugin also generates native versions for your annotated suspend functions:

import com.rickclephas.kmp.nativecoroutines.NativeCoroutines

class RandomLettersGenerator {
    // Somewhere in your Kotlin code you define a suspend function
    // and annotate it with @NativeCoroutines
    @NativeCoroutines
    suspend fun getRandomLetters(): String { 
        // Code to generate some random letters
    }
}
Generated code

The plugin will generate this native function for you:

import com.rickclephas.kmp.nativecoroutines.nativeSuspend
import kotlin.native.ObjCName

@ObjCName(name = "getRandomLetters")
fun RandomLettersGenerator.getRandomLettersNative() =
    nativeSuspend { getRandomLetters() }

Interface limitations

Unfortunately extension functions/properties aren't supported on Objective-C protocols.

However this limitation can be "overcome" with some Swift magic.
Assuming RandomLettersGenerator is an interface instead of a class we can do the following:

import KMPNativeCoroutinesCore

extension RandomLettersGenerator {
    func getRandomLetters() -> NativeSuspend<String, Error, KotlinUnit> {
        RandomLettersGeneratorNativeKt.getRandomLetters(self)
    }
}

Exposed coroutines checks

When suspend functions and/or Flow declarations are exposed to ObjC/Swift, the compiler and IDE plugin will produce a warning, reminding you to add one of the KMP-NativeCoroutines annotations.

You can customise the severity of these checks in your build.gradle.kts file:

nativeCoroutines {
    exposedSeverity = ExposedSeverity.ERROR
}

Or, if you are not interested in these checks, disable them:

nativeCoroutines {
    exposedSeverity = ExposedSeverity.NONE
}

Swift Concurrency

The Async implementation provides some functions to get async Swift functions and AsyncSequences.

Async functions

Use the asyncFunction(for:) function to get an async function that can be awaited:

import KMPNativeCoroutinesAsync

let handle = Task {
    do {
        let letters = try await asyncFunction(for: randomLettersGenerator.getRandomLetters())
        print("Got random letters: \(letters)")
    } catch {
        print("Failed with error: \(error)")
    }
}

// To cancel the suspend function just cancel the async task
handle.cancel()

or if you don't like these do-catches you can use the asyncResult(for:) function:

import KMPNativeCoroutinesAsync

let result = await asyncResult(for: randomLettersGenerator.getRandomLetters())
if case let .success(letters) = result {
    print("Got random letters: \(letters)")
}

for Unit returning functions there is also the asyncError(for:) function:

import KMPNativeCoroutinesAsync

if let error = await asyncError(for: integrationTests.returnUnit()) {
    print("Failed with error: \(error)")
}

AsyncSequence

For Flows there is the asyncSequence(for:) function to get an AsyncSequence:

import KMPNativeCoroutinesAsync

let handle = Task {
    do {
        let sequence = asyncSequence(for: randomLettersGenerator.getRandomLettersFlow())
        for try await letters in sequence {
            print("Got random letters: \(letters)")
        }
    } catch {
        print("Failed with error: \(error)")
    }
}

// To cancel the flow (collection) just cancel the async task
handle.cancel()

Combine

The Combine implementation provides a couple functions to get an AnyPublisher for your Coroutines code.

Note

These functions create deferred AnyPublishers.
Meaning every subscription will trigger the collection of the Flow or execution of the suspend function.

Note

You must keep a reference to the returned Cancellables otherwise the collection will be cancelled immediately.

Publisher

For your Flows use the createPublisher(for:) function:

import KMPNativeCoroutinesCombine

// Create an AnyPublisher for your flow
let publisher = createPublisher(for: clock.time)

// Now use this publisher as you would any other
let cancellable = publisher.sink { completion in
    print("Received completion: \(completion)")
} receiveValue: { value in
    print("Received value: \(value)")
}

// To cancel the flow (collection) just cancel the publisher
cancellable.cancel()

You can also use the createPublisher(for:) function for suspend functions that return a Flow:

let publisher = createPublisher(for: randomLettersGenerator.getRandomLettersFlow())

Future

For the suspend functions you should use the createFuture(for:) function:

import KMPNativeCoroutinesCombine

// Create a Future/AnyPublisher for the suspend function
let future = createFuture(for: randomLettersGenerator.getRandomLetters())

// Now use this future as you would any other
let cancellable = future.sink { completion in
    print("Received completion: \(completion)")
} receiveValue: { value in
    print("Received value: \(value)")
}

// To cancel the suspend function just cancel the future
cancellable.cancel()

RxSwift

The RxSwift implementation provides a couple functions to get an Observable or Single for your Coroutines code.

Note

These functions create deferred Observables and Singles.
Meaning every subscription will trigger the collection of the Flow or execution of the suspend function.

Observable

For your Flows use the createObservable(for:) function:

import KMPNativeCoroutinesRxSwift

// Create an observable for your flow
let observable = createObservable(for: clock.time)

// Now use this observable as you would any other
let disposable = observable.subscribe(onNext: { value in
    print("Received value: \(value)")
}, onError: { error in
    print("Received error: \(error)")
}, onCompleted: {
    print("Observable completed")
}, onDisposed: {
    print("Observable disposed")
})

// To cancel the flow (collection) just dispose the subscription
disposable.dispose()

You can also use the createObservable(for:) function for suspend functions that return a Flow:

let observable = createObservable(for: randomLettersGenerator.getRandomLettersFlow())

Single

For the suspend functions you should use the createSingle(for:) function:

import KMPNativeCoroutinesRxSwift

// Create a single for the suspend function
let single = createSingle(for: randomLettersGenerator.getRandomLetters())

// Now use this single as you would any other
let disposable = single.subscribe(onSuccess: { value in
    print("Received value: \(value)")
}, onFailure: { error in
    print("Received error: \(error)")
}, onDisposed: {
    print("Single disposed")
})

// To cancel the suspend function just dispose the subscription
disposable.dispose()

Customize

There are a number of ways you can customize the generated Kotlin code.

Name suffix

Don't like the naming of the generated properties/functions?
Specify your own custom suffixes in your build.gradle.kts file:

nativeCoroutines {
    // The suffix used to generate the native coroutine function and property names.
    suffix = "Native"
    // The suffix used to generate the native coroutine file names.
    // Note: defaults to the suffix value when `null`.
    fileSuffix = null
    // The suffix used to generate the StateFlow value property names,
    // or `null` to remove the value properties.
    flowValueSuffix = "Value"
    // The suffix used to generate the SharedFlow replayCache property names,
    // or `null` to remove the replayCache properties.
    flowReplayCacheSuffix = "ReplayCache"
    // The suffix used to generate the native state property names.
    stateSuffix = "Value"
    // The suffix used to generate the `StateFlow` flow property names,
    // or `null` to remove the flow properties.
    stateFlowSuffix = "Flow"
}

CoroutineScope

For more control you can provide a custom CoroutineScope with the NativeCoroutineScope annotation:

import com.rickclephas.kmp.nativecoroutines.NativeCoroutineScope

class Clock {
    @NativeCoroutineScope
    internal val coroutineScope = CoroutineScope(job + Dispatchers.Default)
}

Note

Your custom coroutine scope must be either internal or public.

If you don't provide a CoroutineScope the default scope will be used which is defined as:

internal val defaultCoroutineScope = CoroutineScope(SupervisorJob() + Dispatchers.Default)

Note

KMP-NativeCoroutines has built-in support for KMP-ObservableViewModel.
Coroutines inside your ViewModel will (by default) use the CoroutineScope from the ViewModelScope.

Ignoring declarations

Use the NativeCoroutinesIgnore annotation to tell the plugin to ignore a property or function:

import com.rickclephas.kmp.nativecoroutines.NativeCoroutinesIgnore

@NativeCoroutinesIgnore
val ignoredFlowProperty: Flow<Int>

@NativeCoroutinesIgnore
suspend fun ignoredSuspendFunction() { }

Refining declarations in Swift

If for some reason you would like to further refine your Kotlin declarations in Swift, you can use the NativeCoroutinesRefined and NativeCoroutinesRefinedState annotations.
These will tell the plugin to add the ShouldRefineInSwift annotation to the generated properties/function.

Note

This currently requires a module-wide opt-in to kotlin.experimental.ExperimentalObjCRefinement.

You could for example refine your Flow property to an AnyPublisher property:

import com.rickclephas.kmp.nativecoroutines.NativeCoroutinesRefined

class Clock {
    @NativeCoroutinesRefined
    val time: StateFlow<Long>
}
import KMPNativeCoroutinesCombine

extension Clock {
    var time: AnyPublisher<KotlinLong, Error> {
        createPublisher(for: __time)
    }
}

kmp-nativecoroutines's People

Contributors

ankushg avatar litclimbing avatar rickclephas avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

kmp-nativecoroutines's Issues

Build fails with recursion error if kotlinx.serialization is also applied

When the kotlinx.serialization plugin is applied the build fails with a recursion error for the following class:

@Serializable
class Base64ByteArray(val value: ByteArray) {
    @Serializer(Base64ByteArray::class)
    companion object : KSerializer<Base64ByteArray> {
        override val descriptor = PrimitiveSerialDescriptor("Base64ByteArray", PrimitiveKind.STRING)
        override fun serialize(encoder: Encoder, obj: Base64ByteArray) = encoder.encodeString(obj.value.decodeToString())
        override fun deserialize(decoder: Decoder) = Base64ByteArray(decoder.decodeString().encodeToByteArray())
    }

    override fun equals(other: Any?): Boolean {
        if (this === other) return true
        if (other == null || this::class != other::class) return false
        other as Base64ByteArray
        return value.contentEquals(other.value)
    }

    override fun hashCode(): Int {
        return value.contentHashCode()
    }

    override fun toString(): String {
        return "Base64ByteArray(${value})"
    }
}

Also see #23 (comment).

I experienced an error generated in KSwift when I updated the kotlin version and kmp-nativecoroutines version

I updated Kotlin Version to 1.7.20 and updated KMP-NativeCoroutines to version 0.13.1.

The error is like this:

e: java.lang.NoSuchMethodError: 'void org.jetbrains.kotlin.ir.util.IrUtilsKt.passTypeArgumentsFrom$default(org.jetbrains.kotlin.ir.expressions.IrFunctionAccessExpression, org.jetbrains.kotlin.ir.declarations.IrTypeParametersContainer, int, int, java.lang.Object)'
	at com.rickclephas.kmp.nativecoroutines.compiler.KmpNativeCoroutinesIrTransformer.callOriginalFunction(KmpNativeCoroutinesIrTransformer.kt:162)
	at com.rickclephas.kmp.nativecoroutines.compiler.KmpNativeCoroutinesIrTransformer.createNativeBody(KmpNativeCoroutinesIrTransformer.kt:111)
	at com.rickclephas.kmp.nativecoroutines.compiler.KmpNativeCoroutinesIrTransformer.visitFunctionNew(KmpNativeCoroutinesIrTransformer.kt:100)
	at org.jetbrains.kotlin.backend.common.IrElementTransformerVoidWithContext.visitFunction(IrElementTransformerVoidWithContext.kt:83)
	at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitSimpleFunction(IrElementTransformerVoid.kt:72)
	at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitSimpleFunction(IrElementTransformerVoid.kt:73)
	at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitSimpleFunction(IrElementTransformerVoid.kt:24)
	at org.jetbrains.kotlin.ir.declarations.IrSimpleFunction.accept(IrSimpleFunction.kt:28)
	at org.jetbrains.kotlin.ir.IrElementBase.transform(IrElementBase.kt:24)
	at org.jetbrains.kotlin.ir.util.TransformKt.transformInPlace(transform.kt:35)
	at org.jetbrains.kotlin.ir.declarations.IrClass.transformChildren(IrClass.kt:56)
	at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitDeclaration(IrElementTransformerVoid.kt:57)
	at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitClass(IrElementTransformerVoid.kt:66)
	at org.jetbrains.kotlin.backend.common.IrElementTransformerVoidWithContext.visitClassNew(IrElementTransformerVoidWithContext.kt:126)
	at org.jetbrains.kotlin.backend.common.IrElementTransformerVoidWithContext.visitClass(IrElementTransformerVoidWithContext.kt:62)

Is there any solution for this ?

Inferred Types Cause Crash

I just started using the library and ran into a weird issue. If I have a property in my class that has an inferred type, the build crashes. Explicitly adding the type makes it work.

I'm using version 0.11.3-new-mm with Kotlin 1.6.10

For example I have a property in a User class of fullName that I defined like this.

    val fullName = when {
        firstName == null && lastName == null -> null
        firstName == null -> lastName
        lastName == null -> firstName
        else -> "$firstName $lastName"
    }

If I try to build I get the following error.

> Task :shared:compileKotlinIosX64 FAILED
ERROR: Exception while analyzing expression at (41,9) in /Users/justin/AndroidStudioProjects/LitHangboard/shared/src/commonMain/kotlin/com/litclimbing/hangboard/model/User.kt

Attachments:
expression.kt
firstName
org.jetbrains.kotlin.utils.KotlinExceptionWithAttachments: Exception while analyzing expression at (41,9) in /Users/justin/AndroidStudioProjects/LitHangboard/shared/src/commonMain/kotlin/com/litclimbing/hangboard/model/User.kt
	at org.jetbrains.kotlin.types.expressions.ExpressionTypingVisitorDispatcher.logOrThrowException(ExpressionTypingVisitorDispatcher.java:246)
	at org.jetbrains.kotlin.types.expressions.ExpressionTypingVisitorDispatcher.lambda$getTypeInfo$0(ExpressionTypingVisitorDispatcher.java:224)
	at org.jetbrains.kotlin.util.PerformanceCounter.time(PerformanceCounter.kt:101)
	at org.jetbrains.kotlin.types.expressions.ExpressionTypingVisitorDispatcher.getTypeInfo(ExpressionTypingVisitorDispatcher.java:164)
	at org.jetbrains.kotlin.types.expressions.ExpressionTypingVisitorDispatcher.getTypeInfo(ExpressionTypingVisitorDispatcher.java:134)
	at org.jetbrains.kotlin.types.expressions.ExpressionTypingUtils.getTypeInfoOrNullType(ExpressionTypingUtils.java:166)
	at org.jetbrains.kotlin.types.expressions.BasicExpressionTypingVisitor.visitEquality(BasicExpressionTypingVisitor.java:1148)
	at org.jetbrains.kotlin.types.expressions.BasicExpressionTypingVisitor.visitBinaryExpression(BasicExpressionTypingVisitor.java:1078)
	at org.jetbrains.kotlin.types.expressions.ExpressionTypingVisitorDispatcher.visitBinaryExpression(ExpressionTypingVisitorDispatcher.java:403)
	at org.jetbrains.kotlin.types.expressions.ExpressionTypingVisitorDispatcher$ForDeclarations.visitBinaryExpression(ExpressionTypingVisitorDispatcher.java:46)
	at org.jetbrains.kotlin.psi.KtBinaryExpression.accept(KtBinaryExpression.java:35)
	at org.jetbrains.kotlin.types.expressions.ExpressionTypingVisitorDispatcher.lambda$getTypeInfo$0(ExpressionTypingVisitorDispatcher.java:175)
	at org.jetbrains.kotlin.util.PerformanceCounter.time(PerformanceCounter.kt:101)
	at org.jetbrains.kotlin.types.expressions.ExpressionTypingVisitorDispatcher.getTypeInfo(ExpressionTypingVisitorDispatcher.java:164)
	at org.jetbrains.kotlin.types.expressions.ExpressionTypingVisitorDispatcher.getTypeInfo(ExpressionTypingVisitorDispatcher.java:134)
	at org.jetbrains.kotlin.types.expressions.ExpressionTypingUtils.getTypeInfoOrNullType(ExpressionTypingUtils.java:166)
	at org.jetbrains.kotlin.types.expressions.BasicExpressionTypingVisitor.visitBooleanOperationExpression(BasicExpressionTypingVisitor.java:1244)
	at org.jetbrains.kotlin.types.expressions.BasicExpressionTypingVisitor.visitBinaryExpression(BasicExpressionTypingVisitor.java:1091)
	at org.jetbrains.kotlin.types.expressions.ExpressionTypingVisitorDispatcher.visitBinaryExpression(ExpressionTypingVisitorDispatcher.java:403)
	at org.jetbrains.kotlin.types.expressions.ExpressionTypingVisitorDispatcher$ForDeclarations.visitBinaryExpression(ExpressionTypingVisitorDispatcher.java:46)
	at org.jetbrains.kotlin.psi.KtBinaryExpression.accept(KtBinaryExpression.java:35)
	at org.jetbrains.kotlin.types.expressions.ExpressionTypingVisitorDispatcher.lambda$getTypeInfo$0(ExpressionTypingVisitorDispatcher.java:175)
	at org.jetbrains.kotlin.util.PerformanceCounter.time(PerformanceCounter.kt:101)
	at org.jetbrains.kotlin.types.expressions.ExpressionTypingVisitorDispatcher.getTypeInfo(ExpressionTypingVisitorDispatcher.java:164)
	at org.jetbrains.kotlin.types.expressions.ExpressionTypingVisitorDispatcher.getTypeInfo(ExpressionTypingVisitorDispatcher.java:134)
	at org.jetbrains.kotlin.types.expressions.PatternMatchingTypingVisitor.checkTypeForExpressionCondition(PatternMatchingTypingVisitor.kt:566)
	at org.jetbrains.kotlin.types.expressions.PatternMatchingTypingVisitor.access$checkTypeForExpressionCondition(PatternMatchingTypingVisitor.kt:48)
	at org.jetbrains.kotlin.types.expressions.PatternMatchingTypingVisitor$checkWhenCondition$1.visitWhenConditionWithExpression(PatternMatchingTypingVisitor.kt:546)
	at org.jetbrains.kotlin.psi.KtVisitorVoid.visitWhenConditionWithExpression(KtVisitorVoid.java:1017)
	at org.jetbrains.kotlin.psi.KtVisitorVoid.visitWhenConditionWithExpression(KtVisitorVoid.java:21)
	at org.jetbrains.kotlin.psi.KtWhenConditionWithExpression.accept(KtWhenConditionWithExpression.java:36)
	at org.jetbrains.kotlin.psi.KtElementImpl.accept(KtElementImpl.java:51)
	at org.jetbrains.kotlin.types.expressions.PatternMatchingTypingVisitor.checkWhenCondition(PatternMatchingTypingVisitor.kt:493)
	at org.jetbrains.kotlin.types.expressions.PatternMatchingTypingVisitor.analyzeWhenEntryConditions(PatternMatchingTypingVisitor.kt:475)
	at org.jetbrains.kotlin.types.expressions.PatternMatchingTypingVisitor.analyzeConditionsInWhenEntries(PatternMatchingTypingVisitor.kt:346)
	at org.jetbrains.kotlin.types.expressions.PatternMatchingTypingVisitor.visitWhenExpression(PatternMatchingTypingVisitor.kt:220)
	at org.jetbrains.kotlin.types.expressions.PatternMatchingTypingVisitor.visitWhenExpression(PatternMatchingTypingVisitor.kt:88)
	at org.jetbrains.kotlin.types.expressions.ExpressionTypingVisitorDispatcher.visitWhenExpression(ExpressionTypingVisitorDispatcher.java:326)
	at org.jetbrains.kotlin.types.expressions.ExpressionTypingVisitorDispatcher$ForDeclarations.visitWhenExpression(ExpressionTypingVisitorDispatcher.java:46)
	at org.jetbrains.kotlin.psi.KtWhenExpression.accept(KtWhenExpression.java:50)
	at org.jetbrains.kotlin.types.expressions.ExpressionTypingVisitorDispatcher.lambda$getTypeInfo$0(ExpressionTypingVisitorDispatcher.java:175)
	at org.jetbrains.kotlin.util.PerformanceCounter.time(PerformanceCounter.kt:101)
	at org.jetbrains.kotlin.types.expressions.ExpressionTypingVisitorDispatcher.getTypeInfo(ExpressionTypingVisitorDispatcher.java:164)
	at org.jetbrains.kotlin.types.expressions.ExpressionTypingVisitorDispatcher.getTypeInfo(ExpressionTypingVisitorDispatcher.java:134)
	at org.jetbrains.kotlin.types.expressions.ExpressionTypingVisitorDispatcher.getTypeInfo(ExpressionTypingVisitorDispatcher.java:146)
	at org.jetbrains.kotlin.types.expressions.ExpressionTypingServices.getTypeInfo(ExpressionTypingServices.java:120)
	at org.jetbrains.kotlin.types.expressions.ExpressionTypingServices.getTypeInfo(ExpressionTypingServices.java:95)
	at org.jetbrains.kotlin.types.expressions.ExpressionTypingServices.getType(ExpressionTypingServices.java:137)
	at org.jetbrains.kotlin.types.expressions.ExpressionTypingServices.safeGetType(ExpressionTypingServices.java:80)
	at org.jetbrains.kotlin.resolve.VariableTypeAndInitializerResolver.resolveInitializerType(VariableTypeAndInitializerResolver.kt:184)
	at org.jetbrains.kotlin.resolve.VariableTypeAndInitializerResolver.access$resolveInitializerType(VariableTypeAndInitializerResolver.kt:27)
	at org.jetbrains.kotlin.resolve.VariableTypeAndInitializerResolver$resolveTypeNullable$1.invoke(VariableTypeAndInitializerResolver.kt:92)
	at org.jetbrains.kotlin.resolve.VariableTypeAndInitializerResolver$resolveTypeNullable$1.invoke(VariableTypeAndInitializerResolver.kt:85)
	at org.jetbrains.kotlin.storage.LockBasedStorageManager$LockBasedLazyValue.invoke(LockBasedStorageManager.java:408)
	at org.jetbrains.kotlin.storage.LockBasedStorageManager$LockBasedNotNullLazyValue.invoke(LockBasedStorageManager.java:527)
	at org.jetbrains.kotlin.types.DeferredType.getDelegate(DeferredType.java:106)
	at org.jetbrains.kotlin.types.WrappedType.getConstructor(KotlinType.kt:127)
	at com.rickclephas.kmp.nativecoroutines.compiler.utils.FlowKt.isFlowType(Flow.kt:24)
	at com.rickclephas.kmp.nativecoroutines.compiler.utils.FlowKt.getHasFlowType(Flow.kt:32)
	at com.rickclephas.kmp.nativecoroutines.compiler.utils.CoroutinesPropertyKt.isCoroutinesProperty(CoroutinesProperty.kt:8)
	at com.rickclephas.kmp.nativecoroutines.compiler.utils.CoroutinesPropertyKt.getNeedsNativeProperty(CoroutinesProperty.kt:14)
	at com.rickclephas.kmp.nativecoroutines.compiler.KmpNativeCoroutinesSyntheticResolveExtension.getSyntheticPropertiesNames(KmpNativeCoroutinesSyntheticResolveExtension.kt:65)
=====REMOVED SECTION=====
Caused by: java.lang.AssertionError: Recursion detected in a lazy value under LockBasedStorageManager@5dc0fce (TopDownAnalyzer for Konan)
	at org.jetbrains.kotlin.resolve.lazy.descriptors.LazyClassMemberScope.get_allNames(LazyClassMemberScope.kt:178)
	at org.jetbrains.kotlin.resolve.lazy.descriptors.LazyClassMemberScope.definitelyDoesNotContainName(LazyClassMemberScope.kt:199)
	at org.jetbrains.kotlin.resolve.calls.tower.TowerResolver$Task.mayFitForName(TowerResolver.kt:265)
	at org.jetbrains.kotlin.resolve.calls.tower.TowerResolver$Task.mayFitForName(TowerResolver.kt:258)
	at org.jetbrains.kotlin.resolve.calls.tower.TowerResolver$Task.processImplicitReceiver(TowerResolver.kt:230)
	at org.jetbrains.kotlin.resolve.calls.tower.TowerResolver$Task.run$processScope(TowerResolver.kt:198)
	at org.jetbrains.kotlin.resolve.calls.tower.TowerResolver$Task.run(TowerResolver.kt:209)
	at org.jetbrains.kotlin.resolve.calls.tower.TowerResolver.run(TowerResolver.kt:99)
	at org.jetbrains.kotlin.resolve.calls.tower.TowerResolver.runResolve(TowerResolver.kt:86)
	at org.jetbrains.kotlin.resolve.calls.KotlinCallResolver.resolveCall(KotlinCallResolver.kt:75)
	at org.jetbrains.kotlin.resolve.calls.tower.PSICallResolver.runResolutionAndInference(PSICallResolver.kt:101)
	at org.jetbrains.kotlin.resolve.calls.CallResolver.doResolveCallOrGetCachedResults(CallResolver.java:601)
	at org.jetbrains.kotlin.resolve.calls.CallResolver.lambda$computeTasksAndResolveCall$0(CallResolver.java:213)
	at org.jetbrains.kotlin.util.PerformanceCounter.time(PerformanceCounter.kt:101)
	at org.jetbrains.kotlin.resolve.calls.CallResolver.computeTasksAndResolveCall(CallResolver.java:211)
	at org.jetbrains.kotlin.resolve.calls.CallResolver.computeTasksAndResolveCall(CallResolver.java:199)
	at org.jetbrains.kotlin.resolve.calls.CallResolver.resolveSimpleProperty(CallResolver.java:140)
	at org.jetbrains.kotlin.resolve.calls.CallExpressionResolver.getVariableType(CallExpressionResolver.kt:111)
	at org.jetbrains.kotlin.resolve.calls.CallExpressionResolver.getSimpleNameExpressionTypeInfo(CallExpressionResolver.kt:146)
	at org.jetbrains.kotlin.resolve.calls.CallExpressionResolver.getSimpleNameExpressionTypeInfo(CallExpressionResolver.kt:135)
	at org.jetbrains.kotlin.types.expressions.BasicExpressionTypingVisitor.visitSimpleNameExpression(BasicExpressionTypingVisitor.java:172)
	at org.jetbrains.kotlin.types.expressions.ExpressionTypingVisitorDispatcher.visitSimpleNameExpression(ExpressionTypingVisitorDispatcher.java:333)
	at org.jetbrains.kotlin.types.expressions.ExpressionTypingVisitorDispatcher$ForDeclarations.visitSimpleNameExpression(ExpressionTypingVisitorDispatcher.java:46)
	at org.jetbrains.kotlin.psi.KtNameReferenceExpression.accept(KtNameReferenceExpression.kt:59)
	at org.jetbrains.kotlin.types.expressions.ExpressionTypingVisitorDispatcher.lambda$getTypeInfo$0(ExpressionTypingVisitorDispatcher.java:175)
	... 310 more
e: Compilation failed: Exception while analyzing expression at (41,9) in /Users/justin/AndroidStudioProjects/LitHangboard/shared/src/commonMain/kotlin/com/litclimbing/hangboard/model/User.kt

FAILURE: Build failed with an exception.

If I instead change it to the following (adding the String? type), everything works as expected.

    val fullName: String? = when {
        firstName == null && lastName == null -> null
        firstName == null -> lastName
        lastName == null -> firstName
        else -> "$firstName $lastName"
    }

Inheriting same function from multiple interfaces requires override

Hey,
using an interface with the same functions from multiple interfaces works with plain Kotlin, but not with your plugin.

import kotlinx.coroutines.flow.*

interface A {
    fun foo(): Flow<Int>
}

interface B {
    fun foo(): Flow<Int>
}

interface C: A, B

Without your plugin: successful build.
With your plugin:
e: /Users/philipwedemann/Downloads/multiInterface/src/iosArm64Main/kotlin/Main.kt: (11, 1): Class 'C' must override public open fun fooNative(): NativeFlow<Int> /* = (onItem: (Int, Unit) -> Unit, onComplete: NativeCallback<NSError?> /* = (NSError?, Unit) -> Unit */) -> NativeCancellable /* = () -> Unit */ */ defined in A because it inherits multiple interface methods of it

Versions:
Kotlin 1.6.10
Coroutines: 1.6.0-native-mt
com.rickclephas.kmp.nativecoroutines: 0.11.3

multiInterface.zip

Flow/Combine: Type mismatch using createPublisher() for non-primitives

Together with Kotlin 1.7.20, I'm using version 0.13.1 of both the Gradle/Kotlin plugin and the Swift package.
I'm trying to use the Combine implementation to wrap a Flow (StateFlow) from Swift.

The Kotlin side looks like this:

open class PlayerViewModel : SharedViewModel() {
    private val _frontendState: MutableStateFlow<FrontendState> = MutableStateFlow(FrontendState.Disconnected)
    val frontendState: StateFlow<FrontendState> get() = _frontendState

    // ...
}

And this is the Swift side:

import Foundation
import Shared
import KMPNativeCoroutinesCombine
import Combine

class PlayerViewModelShim: ObservableObject {
    private let delegate = Shared.PlayerViewModel()

    @Published var frontendState: FrontendState?

    init() {
        createPublisher(for: delegate.frontendStateNative) // error
            .receive(on: DispatchQueue.main)
            .assign(to: \.frontendState, on: self)
    }

    // ...
}

where FrontendState is some Kotlin sealed class.

This yields the following Swift compile error:

PlayerViewModelShim.swift:22:39: Cannot convert value of type '(@escaping (FrontendState, KotlinUnit) -> KotlinUnit, @escaping ((any Error)?, KotlinUnit) -> KotlinUnit) -> () -> KotlinUnit' to expected argument type '(@escaping (FrontendState?, KotlinUnit) -> KotlinUnit, @escaping (Never?, KotlinUnit) -> KotlinUnit) -> () -> KotlinUnit

Note that consuming the same Flow using the Async implementation and asyncStream very much compiles.

As it stands, the sample of this project compiles as well.
However, this seems to be related to the fact that a Flow of mere Longs is being consumed there; swapping for some arbitrary complex type also breaks Swift compilation of the sample.

Implicit return type inside generic class with variance annotation causes recursion errors

I'm using this commit to use that class in multiplatform and when I import your plug-in it gives me this error:

e: org.jetbrains.kotlin.util.KotlinFrontEndException: Exception while analyzing expression at (112,34) in StateMachine.kt

Attachments:
expression.kt
mutableListOf<(T) -> Boolean>({ clazz.isInstance(it) })
	at org.jetbrains.kotlin.types.expressions.ExpressionTypingVisitorDispatcher.logOrThrowException(ExpressionTypingVisitorDispatcher.java:253)
	at org.jetbrains.kotlin.types.expressions.ExpressionTypingVisitorDispatcher.lambda$getTypeInfo$0(ExpressionTypingVisitorDispatcher.java:224)
	at org.jetbrains.kotlin.util.PerformanceCounter.time(PerformanceCounter.kt:101)
	at org.jetbrains.kotlin.types.expressions.ExpressionTypingVisitorDispatcher.getTypeInfo(ExpressionTypingVisitorDispatcher.java:164)
	at org.jetbrains.kotlin.types.expressions.ExpressionTypingVisitorDispatcher.getTypeInfo(ExpressionTypingVisitorDispatcher.java:134)
	at org.jetbrains.kotlin.types.expressions.ExpressionTypingVisitorDispatcher.getTypeInfo(ExpressionTypingVisitorDispatcher.java:146)
	at org.jetbrains.kotlin.types.expressions.ExpressionTypingServices.getTypeInfo(ExpressionTypingServices.java:120)
	at org.jetbrains.kotlin.types.expressions.ExpressionTypingServices.getTypeInfo(ExpressionTypingServices.java:95)
	at org.jetbrains.kotlin.types.expressions.ExpressionTypingServices.getType(ExpressionTypingServices.java:137)
	at org.jetbrains.kotlin.types.expressions.ExpressionTypingServices.safeGetType(ExpressionTypingServices.java:80)
	at org.jetbrains.kotlin.resolve.VariableTypeAndInitializerResolver.resolveInitializerType(VariableTypeAndInitializerResolver.kt:184)
	at org.jetbrains.kotlin.resolve.VariableTypeAndInitializerResolver.access$resolveInitializerType(VariableTypeAndInitializerResolver.kt:27)
	at org.jetbrains.kotlin.resolve.VariableTypeAndInitializerResolver$resolveTypeNullable$1.invoke(VariableTypeAndInitializerResolver.kt:92)
	at org.jetbrains.kotlin.resolve.VariableTypeAndInitializerResolver$resolveTypeNullable$1.invoke(VariableTypeAndInitializerResolver.kt:85)
	at org.jetbrains.kotlin.storage.LockBasedStorageManager$LockBasedLazyValue.invoke(LockBasedStorageManager.java:408)
	at org.jetbrains.kotlin.storage.LockBasedStorageManager$LockBasedNotNullLazyValue.invoke(LockBasedStorageManager.java:527)
	at org.jetbrains.kotlin.types.DeferredType.getDelegate(DeferredType.java:106)
	at org.jetbrains.kotlin.types.WrappedType.getConstructor(KotlinType.kt:127)
	at org.jetbrains.kotlin.resolve.VarianceCheckerCore.checkTypePosition(VarianceChecker.kt:147)
	at org.jetbrains.kotlin.resolve.VarianceCheckerCore.checkTypePosition(VarianceChecker.kt:144)
	at org.jetbrains.kotlin.resolve.VarianceCheckerCore.checkCallableDeclaration(VarianceChecker.kt:122)
	at org.jetbrains.kotlin.resolve.VarianceCheckerCore.recordPrivateToThisIfNeeded(VarianceChecker.kt:100)
	at org.jetbrains.kotlin.resolve.lazy.descriptors.LazyClassMemberScope.resolveUnknownVisibilitiesForMembers(LazyClassMemberScope.kt:405)
	at org.jetbrains.kotlin.resolve.lazy.descriptors.LazyClassMemberScope.getContributedVariables(LazyClassMemberScope.kt:396)
	at org.jetbrains.kotlin.resolve.lazy.LazyDeclarationResolver$resolveToDescriptor$1.visitProperty(LazyDeclarationResolver.kt:182)
	at org.jetbrains.kotlin.resolve.lazy.LazyDeclarationResolver$resolveToDescriptor$1.visitProperty(LazyDeclarationResolver.kt:94)
	at org.jetbrains.kotlin.psi.KtProperty.accept(KtProperty.java:58)
	at org.jetbrains.kotlin.resolve.lazy.LazyDeclarationResolver.resolveToDescriptor(LazyDeclarationResolver.kt:94)
	at org.jetbrains.kotlin.resolve.lazy.LazyDeclarationResolver.resolveToDescriptor(LazyDeclarationResolver.kt:91)
	at org.jetbrains.kotlin.resolve.LazyTopDownAnalyzer.createPropertyDescriptors(LazyTopDownAnalyzer.kt:275)
	at org.jetbrains.kotlin.resolve.LazyTopDownAnalyzer.analyzeDeclarations(LazyTopDownAnalyzer.kt:208)
	at org.jetbrains.kotlin.resolve.LazyTopDownAnalyzer.analyzeDeclarations$default(LazyTopDownAnalyzer.kt:58)
	at org.jetbrains.kotlin.backend.konan.TopDownAnalyzerFacadeForKonan.analyzeFilesWithGivenTrace(TopDownAnalyzerFacadeForKonan.kt:96)
	at org.jetbrains.kotlin.backend.konan.TopDownAnalyzerFacadeForKonan.analyzeFiles(TopDownAnalyzerFacadeForKonan.kt:57)
	at org.jetbrains.kotlin.backend.konan.KonanDriverKt$frontendPhase$1.invoke(KonanDriver.kt:54)
	at org.jetbrains.kotlin.backend.konan.KonanDriverKt$frontendPhase$1.invoke(KonanDriver.kt:53)
	at org.jetbrains.kotlin.cli.common.messages.AnalyzerWithCompilerReport.analyzeAndReport(AnalyzerWithCompilerReport.kt:113)
	at org.jetbrains.kotlin.backend.konan.KonanDriverKt.frontendPhase(KonanDriver.kt:53)
	at org.jetbrains.kotlin.backend.konan.KonanDriverKt.runTopLevelPhases(KonanDriver.kt:31)
	at org.jetbrains.kotlin.cli.bc.K2Native.doExecute(K2Native.kt:81)
	at org.jetbrains.kotlin.cli.bc.K2Native.doExecute(K2Native.kt:37)
	at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:92)
	at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:44)
	at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:98)
	at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:76)
	at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:45)
	at org.jetbrains.kotlin.cli.common.CLITool$Companion.doMainNoExit(CLITool.kt:227)
	at org.jetbrains.kotlin.cli.bc.K2Native$Companion$mainNoExitWithGradleRenderer$1.invoke(K2Native.kt:393)
	at org.jetbrains.kotlin.cli.bc.K2Native$Companion$mainNoExitWithGradleRenderer$1.invoke(K2Native.kt:392)
	at org.jetbrains.kotlin.util.UtilKt.profileIf(Util.kt:22)
	at org.jetbrains.kotlin.util.UtilKt.profile(Util.kt:16)
	at org.jetbrains.kotlin.cli.bc.K2Native$Companion.mainNoExitWithGradleRenderer(K2Native.kt:392)
	at org.jetbrains.kotlin.cli.bc.K2NativeKt.mainNoExitWithGradleRenderer(K2Native.kt:634)
	at org.jetbrains.kotlin.cli.utilities.MainKt$daemonMain$1.invoke(main.kt:62)
	at org.jetbrains.kotlin.cli.utilities.MainKt$daemonMain$1.invoke(main.kt:62)
	at org.jetbrains.kotlin.cli.utilities.MainKt.mainImpl(main.kt:17)
	at org.jetbrains.kotlin.cli.utilities.MainKt.daemonMain(main.kt:62)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.jetbrains.kotlin.compilerRunner.KotlinToolRunner.runInProcess(KotlinToolRunner.kt:130)
	at org.jetbrains.kotlin.compilerRunner.KotlinToolRunner.run(KotlinToolRunner.kt:77)
	at org.jetbrains.kotlin.gradle.tasks.AbstractKotlinNativeCompile.compile(KotlinNativeTasks.kt:366)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:104)
	at org.gradle.api.internal.project.taskfactory.StandardTaskAction.doExecute(StandardTaskAction.java:58)
	at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:51)
	at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:29)
	at org.gradle.api.internal.tasks.execution.TaskExecution$3.run(TaskExecution.java:242)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:29)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:26)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:66)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:59)
	at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:157)
	at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:59)
	at org.gradle.internal.operations.DefaultBuildOperationRunner.run(DefaultBuildOperationRunner.java:47)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:68)
	at org.gradle.api.internal.tasks.execution.TaskExecution.executeAction(TaskExecution.java:227)
	at org.gradle.api.internal.tasks.execution.TaskExecution.executeActions(TaskExecution.java:210)
	at org.gradle.api.internal.tasks.execution.TaskExecution.executeWithPreviousOutputFiles(TaskExecution.java:193)
	at org.gradle.api.internal.tasks.execution.TaskExecution.execute(TaskExecution.java:171)
	at org.gradle.internal.execution.steps.ExecuteStep.executeInternal(ExecuteStep.java:89)
	at org.gradle.internal.execution.steps.ExecuteStep.access$000(ExecuteStep.java:40)
	at org.gradle.internal.execution.steps.ExecuteStep$1.call(ExecuteStep.java:53)
	at org.gradle.internal.execution.steps.ExecuteStep$1.call(ExecuteStep.java:50)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:204)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:199)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:66)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:59)
	at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:157)
	at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:59)
	at org.gradle.internal.operations.DefaultBuildOperationRunner.call(DefaultBuildOperationRunner.java:53)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:73)
	at org.gradle.internal.execution.steps.ExecuteStep.execute(ExecuteStep.java:50)
	at org.gradle.internal.execution.steps.ExecuteStep.execute(ExecuteStep.java:40)
	at org.gradle.internal.execution.steps.RemovePreviousOutputsStep.execute(RemovePreviousOutputsStep.java:68)
	at org.gradle.internal.execution.steps.RemovePreviousOutputsStep.execute(RemovePreviousOutputsStep.java:38)
	at org.gradle.internal.execution.steps.ResolveInputChangesStep.execute(ResolveInputChangesStep.java:48)
	at org.gradle.internal.execution.steps.ResolveInputChangesStep.execute(ResolveInputChangesStep.java:36)
	at org.gradle.internal.execution.steps.CancelExecutionStep.execute(CancelExecutionStep.java:41)
	at org.gradle.internal.execution.steps.TimeoutStep.executeWithoutTimeout(TimeoutStep.java:74)
	at org.gradle.internal.execution.steps.TimeoutStep.execute(TimeoutStep.java:55)
	at org.gradle.internal.execution.steps.CreateOutputsStep.execute(CreateOutputsStep.java:51)
	at org.gradle.internal.execution.steps.CreateOutputsStep.execute(CreateOutputsStep.java:29)
	at org.gradle.internal.execution.steps.CaptureStateAfterExecutionStep.execute(CaptureStateAfterExecutionStep.java:61)
	at org.gradle.internal.execution.steps.CaptureStateAfterExecutionStep.execute(CaptureStateAfterExecutionStep.java:42)
	at org.gradle.internal.execution.steps.BroadcastChangingOutputsStep.execute(BroadcastChangingOutputsStep.java:60)
	at org.gradle.internal.execution.steps.BroadcastChangingOutputsStep.execute(BroadcastChangingOutputsStep.java:27)
	at org.gradle.internal.execution.steps.BuildCacheStep.executeWithoutCache(BuildCacheStep.java:180)
	at org.gradle.internal.execution.steps.BuildCacheStep.lambda$execute$1(BuildCacheStep.java:75)
	at org.gradle.internal.Either$Right.fold(Either.java:175)
	at org.gradle.internal.execution.caching.CachingState.fold(CachingState.java:59)
	at org.gradle.internal.execution.steps.BuildCacheStep.execute(BuildCacheStep.java:73)
	at org.gradle.internal.execution.steps.BuildCacheStep.execute(BuildCacheStep.java:48)
	at org.gradle.internal.execution.steps.StoreExecutionStateStep.execute(StoreExecutionStateStep.java:36)
	at org.gradle.internal.execution.steps.StoreExecutionStateStep.execute(StoreExecutionStateStep.java:25)
	at org.gradle.internal.execution.steps.RecordOutputsStep.execute(RecordOutputsStep.java:36)
	at org.gradle.internal.execution.steps.RecordOutputsStep.execute(RecordOutputsStep.java:22)
	at org.gradle.internal.execution.steps.SkipUpToDateStep.executeBecause(SkipUpToDateStep.java:110)
	at org.gradle.internal.execution.steps.SkipUpToDateStep.lambda$execute$2(SkipUpToDateStep.java:56)
	at java.base/java.util.Optional.orElseGet(Optional.java:369)
	at org.gradle.internal.execution.steps.SkipUpToDateStep.execute(SkipUpToDateStep.java:56)
	at org.gradle.internal.execution.steps.SkipUpToDateStep.execute(SkipUpToDateStep.java:38)
	at org.gradle.internal.execution.steps.ResolveChangesStep.execute(ResolveChangesStep.java:73)
	at org.gradle.internal.execution.steps.ResolveChangesStep.execute(ResolveChangesStep.java:44)
	at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsFinishedStep.execute(MarkSnapshottingInputsFinishedStep.java:37)
	at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsFinishedStep.execute(MarkSnapshottingInputsFinishedStep.java:27)
	at org.gradle.internal.execution.steps.ResolveCachingStateStep.execute(ResolveCachingStateStep.java:89)
	at org.gradle.internal.execution.steps.ResolveCachingStateStep.execute(ResolveCachingStateStep.java:50)
	at org.gradle.internal.execution.steps.ValidateStep.execute(ValidateStep.java:114)
	at org.gradle.internal.execution.steps.ValidateStep.execute(ValidateStep.java:57)
	at org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.execute(CaptureStateBeforeExecutionStep.java:76)
	at org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.execute(CaptureStateBeforeExecutionStep.java:50)
	at org.gradle.internal.execution.steps.SkipEmptyWorkStep.executeWithNoEmptySources(SkipEmptyWorkStep.java:249)
	at org.gradle.internal.execution.steps.SkipEmptyWorkStep.executeWithNoEmptySources(SkipEmptyWorkStep.java:204)
	at org.gradle.internal.execution.steps.SkipEmptyWorkStep.execute(SkipEmptyWorkStep.java:83)
	at org.gradle.internal.execution.steps.SkipEmptyWorkStep.execute(SkipEmptyWorkStep.java:54)
	at org.gradle.internal.execution.steps.RemoveUntrackedExecutionStateStep.execute(RemoveUntrackedExecutionStateStep.java:32)
	at org.gradle.internal.execution.steps.RemoveUntrackedExecutionStateStep.execute(RemoveUntrackedExecutionStateStep.java:21)
	at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsStartedStep.execute(MarkSnapshottingInputsStartedStep.java:38)
	at org.gradle.internal.execution.steps.LoadPreviousExecutionStateStep.execute(LoadPreviousExecutionStateStep.java:43)
	at org.gradle.internal.execution.steps.LoadPreviousExecutionStateStep.execute(LoadPreviousExecutionStateStep.java:31)
	at org.gradle.internal.execution.steps.AssignWorkspaceStep.lambda$execute$0(AssignWorkspaceStep.java:40)
	at org.gradle.api.internal.tasks.execution.TaskExecution$4.withWorkspace(TaskExecution.java:287)
	at org.gradle.internal.execution.steps.AssignWorkspaceStep.execute(AssignWorkspaceStep.java:40)
	at org.gradle.internal.execution.steps.AssignWorkspaceStep.execute(AssignWorkspaceStep.java:30)
	at org.gradle.internal.execution.steps.IdentityCacheStep.execute(IdentityCacheStep.java:37)
	at org.gradle.internal.execution.steps.IdentityCacheStep.execute(IdentityCacheStep.java:27)
	at org.gradle.internal.execution.steps.IdentifyStep.execute(IdentifyStep.java:44)
	at org.gradle.internal.execution.steps.IdentifyStep.execute(IdentifyStep.java:33)
	at org.gradle.internal.execution.impl.DefaultExecutionEngine$1.execute(DefaultExecutionEngine.java:76)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeIfValid(ExecuteActionsTaskExecuter.java:144)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:133)
	at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:77)
	at org.gradle.api.internal.tasks.execution.FinalizePropertiesTaskExecuter.execute(FinalizePropertiesTaskExecuter.java:46)
	at org.gradle.api.internal.tasks.execution.ResolveTaskExecutionModeExecuter.execute(ResolveTaskExecutionModeExecuter.java:51)
	at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:57)
	at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:56)
	at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:36)
	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.executeTask(EventFiringTaskExecuter.java:77)
	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:55)
	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:52)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:204)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:199)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:66)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:59)
	at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:157)
	at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:59)
	at org.gradle.internal.operations.DefaultBuildOperationRunner.call(DefaultBuildOperationRunner.java:53)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:73)
	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:52)
	at org.gradle.execution.plan.LocalTaskNodeExecutor.execute(LocalTaskNodeExecutor.java:74)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:333)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:320)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:313)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:299)
	at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.lambda$run$0(DefaultPlanExecutor.java:143)
	at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.execute(DefaultPlanExecutor.java:227)
	at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.executeNextNode(DefaultPlanExecutor.java:218)
	at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.run(DefaultPlanExecutor.java:140)
	at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
	at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.reflect.InvocationTargetException
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at com.rickclephas.kmp.nativecoroutines.compiler.KmpNativeCoroutinesSyntheticResolveExtension.getDeclarations(KmpNativeCoroutinesSyntheticResolveExtension.kt:35)
	at com.rickclephas.kmp.nativecoroutines.compiler.KmpNativeCoroutinesSyntheticResolveExtension.getDeclaredProperties(KmpNativeCoroutinesSyntheticResolveExtension.kt:60)
	at com.rickclephas.kmp.nativecoroutines.compiler.KmpNativeCoroutinesSyntheticResolveExtension.getSyntheticPropertiesNames(KmpNativeCoroutinesSyntheticResolveExtension.kt:64)
	at org.jetbrains.kotlin.resolve.extensions.SyntheticResolveExtension$Companion$getInstance$1.getSyntheticPropertiesNames(SyntheticResolveExtension.kt:57)
	at org.jetbrains.kotlin.resolve.lazy.descriptors.LazyClassMemberScope$_variableNames$2.invoke(LazyClassMemberScope.kt:142)
	at org.jetbrains.kotlin.resolve.lazy.descriptors.LazyClassMemberScope$_variableNames$2.invoke(LazyClassMemberScope.kt:139)
	at org.jetbrains.kotlin.storage.LockBasedStorageManager$LockBasedLazyValue.invoke(LockBasedStorageManager.java:408)
	at org.jetbrains.kotlin.storage.LockBasedStorageManager$LockBasedNotNullLazyValue.invoke(LockBasedStorageManager.java:527)
	at org.jetbrains.kotlin.storage.StorageKt.getValue(storage.kt:42)
	at org.jetbrains.kotlin.resolve.lazy.descriptors.LazyClassMemberScope.get_variableNames(LazyClassMemberScope.kt:139)
	at org.jetbrains.kotlin.resolve.lazy.descriptors.LazyClassMemberScope.getVariableNames(LazyClassMemberScope.kt:194)
	at org.jetbrains.kotlin.resolve.lazy.descriptors.LazyClassMemberScope$_allNames$2.invoke(LazyClassMemberScope.kt:182)
	at org.jetbrains.kotlin.resolve.lazy.descriptors.LazyClassMemberScope$_allNames$2.invoke(LazyClassMemberScope.kt:178)
	at org.jetbrains.kotlin.storage.LockBasedStorageManager$LockBasedLazyValue.invoke(LockBasedStorageManager.java:408)
	at org.jetbrains.kotlin.storage.StorageKt.getValue(storage.kt:44)
	at org.jetbrains.kotlin.resolve.lazy.descriptors.LazyClassMemberScope.get_allNames(LazyClassMemberScope.kt:178)
	at org.jetbrains.kotlin.resolve.lazy.descriptors.LazyClassMemberScope.definitelyDoesNotContainName(LazyClassMemberScope.kt:199)
	at org.jetbrains.kotlin.resolve.calls.tower.TowerResolver$Task.mayFitForName(TowerResolver.kt:265)
	at org.jetbrains.kotlin.resolve.calls.tower.TowerResolver$Task.mayFitForName(TowerResolver.kt:258)
	at org.jetbrains.kotlin.resolve.calls.tower.TowerResolver$Task.processImplicitReceiver(TowerResolver.kt:230)
	at org.jetbrains.kotlin.resolve.calls.tower.TowerResolver$Task.run$processScope(TowerResolver.kt:198)
	at org.jetbrains.kotlin.resolve.calls.tower.TowerResolver$Task.run(TowerResolver.kt:209)
	at org.jetbrains.kotlin.resolve.calls.tower.TowerResolver.run(TowerResolver.kt:99)
	at org.jetbrains.kotlin.resolve.calls.tower.TowerResolver.runResolve(TowerResolver.kt:86)
	at org.jetbrains.kotlin.resolve.calls.KotlinCallResolver.resolveCall(KotlinCallResolver.kt:75)
	at org.jetbrains.kotlin.resolve.calls.tower.PSICallResolver.runResolutionAndInference(PSICallResolver.kt:101)
	at org.jetbrains.kotlin.resolve.calls.CallResolver.doResolveCallOrGetCachedResults(CallResolver.java:601)
	at org.jetbrains.kotlin.resolve.calls.CallResolver.lambda$computeTasksAndResolveCall$0(CallResolver.java:213)
	at org.jetbrains.kotlin.util.PerformanceCounter.time(PerformanceCounter.kt:101)
	at org.jetbrains.kotlin.resolve.calls.CallResolver.computeTasksAndResolveCall(CallResolver.java:211)
	at org.jetbrains.kotlin.resolve.calls.CallResolver.computeTasksAndResolveCall(CallResolver.java:199)
	at org.jetbrains.kotlin.resolve.calls.CallResolver.resolveFunctionCall(CallResolver.java:329)
	at org.jetbrains.kotlin.resolve.calls.CallExpressionResolver.getResolvedCallForFunction(CallExpressionResolver.kt:88)
	at org.jetbrains.kotlin.resolve.calls.CallExpressionResolver.getCallExpressionTypeInfoWithoutFinalTypeCheck(CallExpressionResolver.kt:210)
	at org.jetbrains.kotlin.resolve.calls.CallExpressionResolver.getCallExpressionTypeInfo(CallExpressionResolver.kt:187)
	at org.jetbrains.kotlin.types.expressions.BasicExpressionTypingVisitor.visitCallExpression(BasicExpressionTypingVisitor.java:708)
	at org.jetbrains.kotlin.types.expressions.ExpressionTypingVisitorDispatcher.visitCallExpression(ExpressionTypingVisitorDispatcher.java:388)
	at org.jetbrains.kotlin.types.expressions.ExpressionTypingVisitorDispatcher$ForDeclarations.visitCallExpression(ExpressionTypingVisitorDispatcher.java:46)
	at org.jetbrains.kotlin.psi.KtCallExpression.accept(KtCallExpression.java:35)
	at org.jetbrains.kotlin.types.expressions.ExpressionTypingVisitorDispatcher.lambda$getTypeInfo$0(ExpressionTypingVisitorDispatcher.java:175)
	... 187 more
Caused by: org.jetbrains.kotlin.util.ReenteringLazyValueComputationException


FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':shared:compileKotlinIosX64'.
> Compilation finished with errors

code:

class Matcher<T : Any, out R : T> private constructor(private val clazz: KClass<R>) {

        private val predicates = mutableListOf<(T) -> Boolean>({ clazz.isInstance(it) })

If I remove your plugin it works (but then I wont get that nice generated code ๐Ÿ˜…).
What could it be?

commonMainMetadataElements variant missing since 0.12.0 (Kotlin 1.6.20)

I'm using this library for our shared library and having this following issue after upgrading to version 0.12.x (0.12.0, 0.12.1, 0.12.2 with Kotlin 1.6.21 and 0.12.3 with Kotlin 1.7.0). There is no issue with version 0.11.x. Do you have any idea?

Execution failed for task ':KmpSdk:compileKotlinMetadata'.
> Error while evaluating property 'filteredArgumentsMap' of task ':KmpSdk:compileKotlinMetadata'
   > Could not resolve all files for configuration ':KmpSdk:metadataCompileClasspath'.
      > Could not resolve com.rickclephas.kmp:kmp-nativecoroutines-core:0.12.0.
        Required by:
            project :KmpSdk
         > The consumer was configured to find a usage of 'kotlin-api' of a library, preferably optimized for non-jvm, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'common'. However we cannot choose between the following variants of com.rickclephas.kmp:kmp-nativecoroutines-core:0.12.0:
             - iosArm64ApiElements-published
             - iosSimulatorArm64ApiElements-published
             - iosX64ApiElements-published
             - jsIrApiElements-published
             - jsLegacyApiElements-published
             - jvmApiElements-published
             - jvmRuntimeElements-published
             - linuxX64ApiElements-published
             - macosArm64ApiElements-published
             - macosX64ApiElements-published
             - mingwX64ApiElements-published
             - tvosArm64ApiElements-published
             - tvosSimulatorArm64ApiElements-published
             - tvosX64ApiElements-published
             - watchosArm32ApiElements-published
             - watchosArm64ApiElements-published
             - watchosSimulatorArm64ApiElements-published
             - watchosX64ApiElements-published
           All of them match the consumer attributes:
             - Variant 'iosArm64ApiElements-published' capability com.rickclephas.kmp:kmp-nativecoroutines-core:0.12.0 declares a usage of 'kotlin-api' of a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native':
                 - Unmatched attributes:
                     - Provides attribute 'artifactType' with value 'org.jetbrains.kotlin.klib' but the consumer didn't ask for it
                     - Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
                     - Provides release status but the consumer didn't ask for it
                     - Provides attribute 'org.jetbrains.kotlin.native.target' with value 'ios_arm64' but the consumer didn't ask for it
             - Variant 'iosSimulatorArm64ApiElements-published' capability com.rickclephas.kmp:kmp-nativecoroutines-core:0.12.0 declares a usage of 'kotlin-api' of a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native':
                 - Unmatched attributes:
                     - Provides attribute 'artifactType' with value 'org.jetbrains.kotlin.klib' but the consumer didn't ask for it
                     - Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
                     - Provides release status but the consumer didn't ask for it
                     - Provides attribute 'org.jetbrains.kotlin.native.target' with value 'ios_simulator_arm64' but the consumer didn't ask for it
             - Variant 'iosX64ApiElements-published' capability com.rickclephas.kmp:kmp-nativecoroutines-core:0.12.0 declares a usage of 'kotlin-api' of a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native':
                 - Unmatched attributes:
                     - Provides attribute 'artifactType' with value 'org.jetbrains.kotlin.klib' but the consumer didn't ask for it
                     - Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
                     - Provides release status but the consumer didn't ask for it
                     - Provides attribute 'org.jetbrains.kotlin.native.target' with value 'ios_x64' but the consumer didn't ask for it
             - Variant 'jsIrApiElements-published' capability com.rickclephas.kmp:kmp-nativecoroutines-core:0.12.0 declares a usage of 'kotlin-api' of a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'js':
                 - Unmatched attributes:
                     - Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
                     - Provides release status but the consumer didn't ask for it
                     - Provides attribute 'org.jetbrains.kotlin.js.compiler' with value 'ir' but the consumer didn't ask for it
             - Variant 'jsLegacyApiElements-published' capability com.rickclephas.kmp:kmp-nativecoroutines-core:0.12.0 declares a usage of 'kotlin-api' of a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'js':
                 - Unmatched attributes:
                     - Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
                     - Provides release status but the consumer didn't ask for it
                     - Provides attribute 'org.jetbrains.kotlin.js.compiler' with value 'legacy' but the consumer didn't ask for it
             - Variant 'jvmApiElements-published' capability com.rickclephas.kmp:kmp-nativecoroutines-core:0.12.0 declares an API of a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm':
                 - Unmatched attributes:
                     - Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
                     - Provides its elements packaged as a jar but the consumer didn't ask for it
                     - Provides release status but the consumer didn't ask for it
             - Variant 'jvmRuntimeElements-published' capability com.rickclephas.kmp:kmp-nativecoroutines-core:0.12.0 declares a runtime of a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm':
                 - Unmatched attributes:
                     - Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
                     - Provides its elements packaged as a jar but the consumer didn't ask for it
                     - Provides release status but the consumer didn't ask for it
             - Variant 'linuxX64ApiElements-published' capability com.rickclephas.kmp:kmp-nativecoroutines-core:0.12.0 declares a usage of 'kotlin-api' of a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native':
                 - Unmatched attributes:
                     - Provides attribute 'artifactType' with value 'org.jetbrains.kotlin.klib' but the consumer didn't ask for it
                     - Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
                     - Provides release status but the consumer didn't ask for it
                     - Provides attribute 'org.jetbrains.kotlin.native.target' with value 'linux_x64' but the consumer didn't ask for it
             - Variant 'macosArm64ApiElements-published' capability com.rickclephas.kmp:kmp-nativecoroutines-core:0.12.0 declares a usage of 'kotlin-api' of a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native':
                 - Unmatched attributes:
                     - Provides attribute 'artifactType' with value 'org.jetbrains.kotlin.klib' but the consumer didn't ask for it
                     - Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
                     - Provides release status but the consumer didn't ask for it
                     - Provides attribute 'org.jetbrains.kotlin.native.target' with value 'macos_arm64' but the consumer didn't ask for it
             - Variant 'macosX64ApiElements-published' capability com.rickclephas.kmp:kmp-nativecoroutines-core:0.12.0 declares a usage of 'kotlin-api' of a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native':
                 - Unmatched attributes:
                     - Provides attribute 'artifactType' with value 'org.jetbrains.kotlin.klib' but the consumer didn't ask for it
                     - Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
                     - Provides release status but the consumer didn't ask for it
                     - Provides attribute 'org.jetbrains.kotlin.native.target' with value 'macos_x64' but the consumer didn't ask for it
             - Variant 'mingwX64ApiElements-published' capability com.rickclephas.kmp:kmp-nativecoroutines-core:0.12.0 declares a usage of 'kotlin-api' of a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native':
                 - Unmatched attributes:
                     - Provides attribute 'artifactType' with value 'org.jetbrains.kotlin.klib' but the consumer didn't ask for it
                     - Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
                     - Provides release status but the consumer didn't ask for it
                     - Provides attribute 'org.jetbrains.kotlin.native.target' with value 'mingw_x64' but the consumer didn't ask for it
             - Variant 'tvosArm64ApiElements-published' capability com.rickclephas.kmp:kmp-nativecoroutines-core:0.12.0 declares a usage of 'kotlin-api' of a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native':
                 - Unmatched attributes:
                     - Provides attribute 'artifactType' with value 'org.jetbrains.kotlin.klib' but the consumer didn't ask for it
                     - Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
                     - Provides release status but the consumer didn't ask for it
                     - Provides attribute 'org.jetbrains.kotlin.native.target' with value 'tvos_arm64' but the consumer didn't ask for it
             - Variant 'tvosSimulatorArm64ApiElements-published' capability com.rickclephas.kmp:kmp-nativecoroutines-core:0.12.0 declares a usage of 'kotlin-api' of a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native':
                 - Unmatched attributes:
                     - Provides attribute 'artifactType' with value 'org.jetbrains.kotlin.klib' but the consumer didn't ask for it
                     - Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
                     - Provides release status but the consumer didn't ask for it
                     - Provides attribute 'org.jetbrains.kotlin.native.target' with value 'tvos_simulator_arm64' but the consumer didn't ask for it
             - Variant 'tvosX64ApiElements-published' capability com.rickclephas.kmp:kmp-nativecoroutines-core:0.12.0 declares a usage of 'kotlin-api' of a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native':
                 - Unmatched attributes:
                     - Provides attribute 'artifactType' with value 'org.jetbrains.kotlin.klib' but the consumer didn't ask for it
                     - Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
                     - Provides release status but the consumer didn't ask for it
                     - Provides attribute 'org.jetbrains.kotlin.native.target' with value 'tvos_x64' but the consumer didn't ask for it
             - Variant 'watchosArm32ApiElements-published' capability com.rickclephas.kmp:kmp-nativecoroutines-core:0.12.0 declares a usage of 'kotlin-api' of a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native':
                 - Unmatched attributes:
                     - Provides attribute 'artifactType' with value 'org.jetbrains.kotlin.klib' but the consumer didn't ask for it
                     - Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
                     - Provides release status but the consumer didn't ask for it
                     - Provides attribute 'org.jetbrains.kotlin.native.target' with value 'watchos_arm32' but the consumer didn't ask for it
             - Variant 'watchosArm64ApiElements-published' capability com.rickclephas.kmp:kmp-nativecoroutines-core:0.12.0 declares a usage of 'kotlin-api' of a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native':
                 - Unmatched attributes:
                     - Provides attribute 'artifactType' with value 'org.jetbrains.kotlin.klib' but the consumer didn't ask for it
                     - Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
                     - Provides release status but the consumer didn't ask for it
                     - Provides attribute 'org.jetbrains.kotlin.native.target' with value 'watchos_arm64' but the consumer didn't ask for it
             - Variant 'watchosSimulatorArm64ApiElements-published' capability com.rickclephas.kmp:kmp-nativecoroutines-core:0.12.0 declares a usage of 'kotlin-api' of a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native':
                 - Unmatched attributes:
                     - Provides attribute 'artifactType' with value 'org.jetbrains.kotlin.klib' but the consumer didn't ask for it
                     - Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
                     - Provides release status but the consumer didn't ask for it
                     - Provides attribute 'org.jetbrains.kotlin.native.target' with value 'watchos_simulator_arm64' but the consumer didn't ask for it
             - Variant 'watchosX64ApiElements-published' capability com.rickclephas.kmp:kmp-nativecoroutines-core:0.12.0 declares a usage of 'kotlin-api' of a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native':
                 - Unmatched attributes:
                     - Provides attribute 'artifactType' with value 'org.jetbrains.kotlin.klib' but the consumer didn't ask for it
                     - Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
                     - Provides release status but the consumer didn't ask for it
                     - Provides attribute 'org.jetbrains.kotlin.native.target' with value 'watchos_x64' but the consumer didn't ask for it
           The following variants were also considered but didn't match the requested attributes:
             - Variant 'iosArm64MetadataElements-published' capability com.rickclephas.kmp:kmp-nativecoroutines-core:0.12.0 declares a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native':
                 - Incompatible because this component declares a usage of 'kotlin-metadata' of a component and the consumer needed a usage of 'kotlin-api' of a component
                 - Other compatible attribute:
                     - Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
             - Variant 'iosSimulatorArm64MetadataElements-published' capability com.rickclephas.kmp:kmp-nativecoroutines-core:0.12.0 declares a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native':
                 - Incompatible because this component declares a usage of 'kotlin-metadata' of a component and the consumer needed a usage of 'kotlin-api' of a component
                 - Other compatible attribute:
                     - Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
             - Variant 'iosX64MetadataElements-published' capability com.rickclephas.kmp:kmp-nativecoroutines-core:0.12.0 declares a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native':
                 - Incompatible because this component declares a usage of 'kotlin-metadata' of a component and the consumer needed a usage of 'kotlin-api' of a component
                 - Other compatible attribute:
                     - Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
             - Variant 'jsIrRuntimeElements-published' capability com.rickclephas.kmp:kmp-nativecoroutines-core:0.12.0 declares a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'js':
                 - Incompatible because this component declares a usage of 'kotlin-runtime' of a component and the consumer needed a usage of 'kotlin-api' of a component
                 - Other compatible attribute:
                     - Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
             - Variant 'jsLegacyRuntimeElements-published' capability com.rickclephas.kmp:kmp-nativecoroutines-core:0.12.0 declares a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'js':
                 - Incompatible because this component declares a usage of 'kotlin-runtime' of a component and the consumer needed a usage of 'kotlin-api' of a component
                 - Other compatible attribute:
                     - Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
             - Variant 'macosArm64MetadataElements-published' capability com.rickclephas.kmp:kmp-nativecoroutines-core:0.12.0 declares a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native':
                 - Incompatible because this component declares a usage of 'kotlin-metadata' of a component and the consumer needed a usage of 'kotlin-api' of a component
                 - Other compatible attribute:
                     - Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
             - Variant 'macosX64MetadataElements-published' capability com.rickclephas.kmp:kmp-nativecoroutines-core:0.12.0 declares a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native':
                 - Incompatible because this component declares a usage of 'kotlin-metadata' of a component and the consumer needed a usage of 'kotlin-api' of a component
                 - Other compatible attribute:
                     - Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
             - Variant 'metadataApiElements' capability com.rickclephas.kmp:kmp-nativecoroutines-core:0.12.0 declares a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'common':
                 - Incompatible because this component declares a usage of 'kotlin-metadata' of a component and the consumer needed a usage of 'kotlin-api' of a component
                 - Other compatible attribute:
                     - Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
             - Variant 'tvosArm64MetadataElements-published' capability com.rickclephas.kmp:kmp-nativecoroutines-core:0.12.0 declares a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native':
                 - Incompatible because this component declares a usage of 'kotlin-metadata' of a component and the consumer needed a usage of 'kotlin-api' of a component
                 - Other compatible attribute:
                     - Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
             - Variant 'tvosSimulatorArm64MetadataElements-published' capability com.rickclephas.kmp:kmp-nativecoroutines-core:0.12.0 declares a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native':
                 - Incompatible because this component declares a usage of 'kotlin-metadata' of a component and the consumer needed a usage of 'kotlin-api' of a component
                 - Other compatible attribute:
                     - Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
             - Variant 'tvosX64MetadataElements-published' capability com.rickclephas.kmp:kmp-nativecoroutines-core:0.12.0 declares a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native':
                 - Incompatible because this component declares a usage of 'kotlin-metadata' of a component and the consumer needed a usage of 'kotlin-api' of a component
                 - Other compatible attribute:
                     - Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
             - Variant 'watchosArm32MetadataElements-published' capability com.rickclephas.kmp:kmp-nativecoroutines-core:0.12.0 declares a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native':
                 - Incompatible because this component declares a usage of 'kotlin-metadata' of a component and the consumer needed a usage of 'kotlin-api' of a component
                 - Other compatible attribute:
                     - Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
             - Variant 'watchosArm64MetadataElements-published' capability com.rickclephas.kmp:kmp-nativecoroutines-core:0.12.0 declares a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native':
                 - Incompatible because this component declares a usage of 'kotlin-metadata' of a component and the consumer needed a usage of 'kotlin-api' of a component
                 - Other compatible attribute:
                     - Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
             - Variant 'watchosSimulatorArm64MetadataElements-published' capability com.rickclephas.kmp:kmp-nativecoroutines-core:0.12.0 declares a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native':
                 - Incompatible because this component declares a usage of 'kotlin-metadata' of a component and the consumer needed a usage of 'kotlin-api' of a component
                 - Other compatible attribute:
                     - Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
             - Variant 'watchosX64MetadataElements-published' capability com.rickclephas.kmp:kmp-nativecoroutines-core:0.12.0 declares a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native':
                 - Incompatible because this component declares a usage of 'kotlin-metadata' of a component and the consumer needed a usage of 'kotlin-api' of a component
                 - Other compatible attribute:
                     - Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
      > Could not resolve com.rickclephas.kmp:kmp-nativecoroutines-annotations:0.12.0.
        Required by:
            project :KmpSdk
         > The consumer was configured to find a usage of 'kotlin-api' of a library, preferably optimized for non-jvm, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'common'. However we cannot choose between the following variants of com.rickclephas.kmp:kmp-nativecoroutines-annotations:0.12.0:
             - iosArm64ApiElements-published
             - iosSimulatorArm64ApiElements-published
             - iosX64ApiElements-published
             - jsIrApiElements-published
             - jsLegacyApiElements-published
             - jvmApiElements-published
             - jvmRuntimeElements-published
             - linuxX64ApiElements-published
             - macosArm64ApiElements-published
             - macosX64ApiElements-published
             - mingwX64ApiElements-published
             - tvosArm64ApiElements-published
             - tvosSimulatorArm64ApiElements-published
             - tvosX64ApiElements-published
             - watchosArm32ApiElements-published
             - watchosArm64ApiElements-published
             - watchosSimulatorArm64ApiElements-published
             - watchosX64ApiElements-published
           All of them match the consumer attributes:
             - Variant 'iosArm64ApiElements-published' capability com.rickclephas.kmp:kmp-nativecoroutines-annotations:0.12.0 declares a usage of 'kotlin-api' of a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native':
                 - Unmatched attributes:
                     - Provides attribute 'artifactType' with value 'org.jetbrains.kotlin.klib' but the consumer didn't ask for it
                     - Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
                     - Provides release status but the consumer didn't ask for it
                     - Provides attribute 'org.jetbrains.kotlin.native.target' with value 'ios_arm64' but the consumer didn't ask for it
             - Variant 'iosSimulatorArm64ApiElements-published' capability com.rickclephas.kmp:kmp-nativecoroutines-annotations:0.12.0 declares a usage of 'kotlin-api' of a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native':
                 - Unmatched attributes:
                     - Provides attribute 'artifactType' with value 'org.jetbrains.kotlin.klib' but the consumer didn't ask for it
                     - Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
                     - Provides release status but the consumer didn't ask for it
                     - Provides attribute 'org.jetbrains.kotlin.native.target' with value 'ios_simulator_arm64' but the consumer didn't ask for it
             - Variant 'iosX64ApiElements-published' capability com.rickclephas.kmp:kmp-nativecoroutines-annotations:0.12.0 declares a usage of 'kotlin-api' of a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native':
                 - Unmatched attributes:
                     - Provides attribute 'artifactType' with value 'org.jetbrains.kotlin.klib' but the consumer didn't ask for it
                     - Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
                     - Provides release status but the consumer didn't ask for it
                     - Provides attribute 'org.jetbrains.kotlin.native.target' with value 'ios_x64' but the consumer didn't ask for it
             - Variant 'jsIrApiElements-published' capability com.rickclephas.kmp:kmp-nativecoroutines-annotations:0.12.0 declares a usage of 'kotlin-api' of a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'js':
                 - Unmatched attributes:
                     - Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
                     - Provides release status but the consumer didn't ask for it
                     - Provides attribute 'org.jetbrains.kotlin.js.compiler' with value 'ir' but the consumer didn't ask for it
             - Variant 'jsLegacyApiElements-published' capability com.rickclephas.kmp:kmp-nativecoroutines-annotations:0.12.0 declares a usage of 'kotlin-api' of a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'js':
                 - Unmatched attributes:
                     - Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
                     - Provides release status but the consumer didn't ask for it
                     - Provides attribute 'org.jetbrains.kotlin.js.compiler' with value 'legacy' but the consumer didn't ask for it
             - Variant 'jvmApiElements-published' capability com.rickclephas.kmp:kmp-nativecoroutines-annotations:0.12.0 declares an API of a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm':
                 - Unmatched attributes:
                     - Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
                     - Provides its elements packaged as a jar but the consumer didn't ask for it
                     - Provides release status but the consumer didn't ask for it
             - Variant 'jvmRuntimeElements-published' capability com.rickclephas.kmp:kmp-nativecoroutines-annotations:0.12.0 declares a runtime of a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm':
                 - Unmatched attributes:
                     - Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
                     - Provides its elements packaged as a jar but the consumer didn't ask for it
                     - Provides release status but the consumer didn't ask for it
             - Variant 'linuxX64ApiElements-published' capability com.rickclephas.kmp:kmp-nativecoroutines-annotations:0.12.0 declares a usage of 'kotlin-api' of a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native':
                 - Unmatched attributes:
                     - Provides attribute 'artifactType' with value 'org.jetbrains.kotlin.klib' but the consumer didn't ask for it
                     - Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
                     - Provides release status but the consumer didn't ask for it
                     - Provides attribute 'org.jetbrains.kotlin.native.target' with value 'linux_x64' but the consumer didn't ask for it
             - Variant 'macosArm64ApiElements-published' capability com.rickclephas.kmp:kmp-nativecoroutines-annotations:0.12.0 declares a usage of 'kotlin-api' of a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native':
                 - Unmatched attributes:
                     - Provides attribute 'artifactType' with value 'org.jetbrains.kotlin.klib' but the consumer didn't ask for it
                     - Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
                     - Provides release status but the consumer didn't ask for it
                     - Provides attribute 'org.jetbrains.kotlin.native.target' with value 'macos_arm64' but the consumer didn't ask for it
             - Variant 'macosX64ApiElements-published' capability com.rickclephas.kmp:kmp-nativecoroutines-annotations:0.12.0 declares a usage of 'kotlin-api' of a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native':
                 - Unmatched attributes:
                     - Provides attribute 'artifactType' with value 'org.jetbrains.kotlin.klib' but the consumer didn't ask for it
                     - Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
                     - Provides release status but the consumer didn't ask for it
                     - Provides attribute 'org.jetbrains.kotlin.native.target' with value 'macos_x64' but the consumer didn't ask for it
             - Variant 'mingwX64ApiElements-published' capability com.rickclephas.kmp:kmp-nativecoroutines-annotations:0.12.0 declares a usage of 'kotlin-api' of a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native':
                 - Unmatched attributes:
                     - Provides attribute 'artifactType' with value 'org.jetbrains.kotlin.klib' but the consumer didn't ask for it
                     - Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
                     - Provides release status but the consumer didn't ask for it
                     - Provides attribute 'org.jetbrains.kotlin.native.target' with value 'mingw_x64' but the consumer didn't ask for it
             - Variant 'tvosArm64ApiElements-published' capability com.rickclephas.kmp:kmp-nativecoroutines-annotations:0.12.0 declares a usage of 'kotlin-api' of a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native':
                 - Unmatched attributes:
                     - Provides attribute 'artifactType' with value 'org.jetbrains.kotlin.klib' but the consumer didn't ask for it
                     - Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
                     - Provides release status but the consumer didn't ask for it
                     - Provides attribute 'org.jetbrains.kotlin.native.target' with value 'tvos_arm64' but the consumer didn't ask for it
             - Variant 'tvosSimulatorArm64ApiElements-published' capability com.rickclephas.kmp:kmp-nativecoroutines-annotations:0.12.0 declares a usage of 'kotlin-api' of a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native':
                 - Unmatched attributes:
                     - Provides attribute 'artifactType' with value 'org.jetbrains.kotlin.klib' but the consumer didn't ask for it
                     - Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
                     - Provides release status but the consumer didn't ask for it
                     - Provides attribute 'org.jetbrains.kotlin.native.target' with value 'tvos_simulator_arm64' but the consumer didn't ask for it
             - Variant 'tvosX64ApiElements-published' capability com.rickclephas.kmp:kmp-nativecoroutines-annotations:0.12.0 declares a usage of 'kotlin-api' of a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native':
                 - Unmatched attributes:
                     - Provides attribute 'artifactType' with value 'org.jetbrains.kotlin.klib' but the consumer didn't ask for it
                     - Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
                     - Provides release status but the consumer didn't ask for it
                     - Provides attribute 'org.jetbrains.kotlin.native.target' with value 'tvos_x64' but the consumer didn't ask for it
             - Variant 'watchosArm32ApiElements-published' capability com.rickclephas.kmp:kmp-nativecoroutines-annotations:0.12.0 declares a usage of 'kotlin-api' of a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native':
                 - Unmatched attributes:
                     - Provides attribute 'artifactType' with value 'org.jetbrains.kotlin.klib' but the consumer didn't ask for it
                     - Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
                     - Provides release status but the consumer didn't ask for it
                     - Provides attribute 'org.jetbrains.kotlin.native.target' with value 'watchos_arm32' but the consumer didn't ask for it
             - Variant 'watchosArm64ApiElements-published' capability com.rickclephas.kmp:kmp-nativecoroutines-annotations:0.12.0 declares a usage of 'kotlin-api' of a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native':
                 - Unmatched attributes:
                     - Provides attribute 'artifactType' with value 'org.jetbrains.kotlin.klib' but the consumer didn't ask for it
                     - Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
                     - Provides release status but the consumer didn't ask for it
                     - Provides attribute 'org.jetbrains.kotlin.native.target' with value 'watchos_arm64' but the consumer didn't ask for it
             - Variant 'watchosSimulatorArm64ApiElements-published' capability com.rickclephas.kmp:kmp-nativecoroutines-annotations:0.12.0 declares a usage of 'kotlin-api' of a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native':
                 - Unmatched attributes:
                     - Provides attribute 'artifactType' with value 'org.jetbrains.kotlin.klib' but the consumer didn't ask for it
                     - Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
                     - Provides release status but the consumer didn't ask for it
                     - Provides attribute 'org.jetbrains.kotlin.native.target' with value 'watchos_simulator_arm64' but the consumer didn't ask for it
             - Variant 'watchosX64ApiElements-published' capability com.rickclephas.kmp:kmp-nativecoroutines-annotations:0.12.0 declares a usage of 'kotlin-api' of a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native':
                 - Unmatched attributes:
                     - Provides attribute 'artifactType' with value 'org.jetbrains.kotlin.klib' but the consumer didn't ask for it
                     - Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
                     - Provides release status but the consumer didn't ask for it
                     - Provides attribute 'org.jetbrains.kotlin.native.target' with value 'watchos_x64' but the consumer didn't ask for it
           The following variants were also considered but didn't match the requested attributes:
             - Variant 'iosArm64MetadataElements-published' capability com.rickclephas.kmp:kmp-nativecoroutines-annotations:0.12.0 declares a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native':
                 - Incompatible because this component declares a usage of 'kotlin-metadata' of a component and the consumer needed a usage of 'kotlin-api' of a component
                 - Other compatible attribute:
                     - Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
             - Variant 'iosSimulatorArm64MetadataElements-published' capability com.rickclephas.kmp:kmp-nativecoroutines-annotations:0.12.0 declares a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native':
                 - Incompatible because this component declares a usage of 'kotlin-metadata' of a component and the consumer needed a usage of 'kotlin-api' of a component
                 - Other compatible attribute:
                     - Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
             - Variant 'iosX64MetadataElements-published' capability com.rickclephas.kmp:kmp-nativecoroutines-annotations:0.12.0 declares a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native':
                 - Incompatible because this component declares a usage of 'kotlin-metadata' of a component and the consumer needed a usage of 'kotlin-api' of a component
                 - Other compatible attribute:
                     - Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
             - Variant 'jsIrRuntimeElements-published' capability com.rickclephas.kmp:kmp-nativecoroutines-annotations:0.12.0 declares a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'js':
                 - Incompatible because this component declares a usage of 'kotlin-runtime' of a component and the consumer needed a usage of 'kotlin-api' of a component
                 - Other compatible attribute:
                     - Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
             - Variant 'jsLegacyRuntimeElements-published' capability com.rickclephas.kmp:kmp-nativecoroutines-annotations:0.12.0 declares a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'js':
                 - Incompatible because this component declares a usage of 'kotlin-runtime' of a component and the consumer needed a usage of 'kotlin-api' of a component
                 - Other compatible attribute:
                     - Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
             - Variant 'macosArm64MetadataElements-published' capability com.rickclephas.kmp:kmp-nativecoroutines-annotations:0.12.0 declares a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native':
                 - Incompatible because this component declares a usage of 'kotlin-metadata' of a component and the consumer needed a usage of 'kotlin-api' of a component
                 - Other compatible attribute:
                     - Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
             - Variant 'macosX64MetadataElements-published' capability com.rickclephas.kmp:kmp-nativecoroutines-annotations:0.12.0 declares a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native':
                 - Incompatible because this component declares a usage of 'kotlin-metadata' of a component and the consumer needed a usage of 'kotlin-api' of a component
                 - Other compatible attribute:
                     - Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
             - Variant 'metadataApiElements' capability com.rickclephas.kmp:kmp-nativecoroutines-annotations:0.12.0 declares a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'common':
                 - Incompatible because this component declares a usage of 'kotlin-metadata' of a component and the consumer needed a usage of 'kotlin-api' of a component
                 - Other compatible attribute:
                     - Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
             - Variant 'tvosArm64MetadataElements-published' capability com.rickclephas.kmp:kmp-nativecoroutines-annotations:0.12.0 declares a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native':
                 - Incompatible because this component declares a usage of 'kotlin-metadata' of a component and the consumer needed a usage of 'kotlin-api' of a component
                 - Other compatible attribute:
                     - Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
             - Variant 'tvosSimulatorArm64MetadataElements-published' capability com.rickclephas.kmp:kmp-nativecoroutines-annotations:0.12.0 declares a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native':
                 - Incompatible because this component declares a usage of 'kotlin-metadata' of a component and the consumer needed a usage of 'kotlin-api' of a component
                 - Other compatible attribute:
                     - Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
             - Variant 'tvosX64MetadataElements-published' capability com.rickclephas.kmp:kmp-nativecoroutines-annotations:0.12.0 declares a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native':
                 - Incompatible because this component declares a usage of 'kotlin-metadata' of a component and the consumer needed a usage of 'kotlin-api' of a component
                 - Other compatible attribute:
                     - Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
             - Variant 'watchosArm32MetadataElements-published' capability com.rickclephas.kmp:kmp-nativecoroutines-annotations:0.12.0 declares a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native':
                 - Incompatible because this component declares a usage of 'kotlin-metadata' of a component and the consumer needed a usage of 'kotlin-api' of a component
                 - Other compatible attribute:
                     - Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
             - Variant 'watchosArm64MetadataElements-published' capability com.rickclephas.kmp:kmp-nativecoroutines-annotations:0.12.0 declares a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native':
                 - Incompatible because this component declares a usage of 'kotlin-metadata' of a component and the consumer needed a usage of 'kotlin-api' of a component
                 - Other compatible attribute:
                     - Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
             - Variant 'watchosSimulatorArm64MetadataElements-published' capability com.rickclephas.kmp:kmp-nativecoroutines-annotations:0.12.0 declares a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native':
                 - Incompatible because this component declares a usage of 'kotlin-metadata' of a component and the consumer needed a usage of 'kotlin-api' of a component
                 - Other compatible attribute:
                     - Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
             - Variant 'watchosX64MetadataElements-published' capability com.rickclephas.kmp:kmp-nativecoroutines-annotations:0.12.0 declares a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native':
                 - Incompatible because this component declares a usage of 'kotlin-metadata' of a component and the consumer needed a usage of 'kotlin-api' of a component
                 - Other compatible attribute:
                     - Doesn't say anything about its target Java environment (preferred optimized for non-jvm)

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

Several random crashes inside NativeFlowPublisher receive method

Hello, first of all thanks fot your work with this library!

My team came across the issue with several, randomly appearing crashes of iOS app.
It occurs in pretty much all publishers inside Publisher.swift file in NativeFlowPublisher struct on func receive<S>(subscriber: S) where S : Subscriber, Failure == S.Failure, Output == S.Input on subscriber.receive(subscription: subscription) method.

Type of error appears in line of sink() operator and it is showing such error:

Crashed: com.apple.root.default-qos
EXC_BREAKPOINT 0x00000001928c6198

Here is an example of iOS class we are currently using and KMM implementation below:

import SwiftUI
import Resolver
import KmmLogic
import Combine
import KMPNativeCoroutinesCombine

class XYZPublisher: NSObject, ObservableObject {

    @Injected private var someCache: SomeCache
    private var cancellables = Set<AnyCancellable>()

    @Published var isAuthenticated: Bool = false

    override init() {
        super.init()
        createPublisher(for: someCache.isAuthenticatedNative)
            .replaceError(with: false)
            .removeDuplicates()
            .receive(on: DispatchQueue.main)
            .sink { [weak self] isAuthenticated in
                guard let self = self,
                      let isAuthenticated = isAuthenticated as? Bool
                else { return }

                self.isAuthenticated = isAuthenticated
            }
            .store(in: &cancellables)
    }
}

and KMM implementation for SomeCache which is a protocol:

interface SomeCache {
    val isAuthenticated: StateFlow<Boolean>
    fun setCurrentUser(user: AppUser?)
    val currentUser: StateFlow<AppUser?>
}

Class implementation:

class InMemorySomeCache(
    authStateInitializer: AuthStateInitializer,
    dispatcherProvider: DispatcherProvider,
) : SomeCache {

    private val scope = CoroutineScope(SupervisorJob() + dispatcherProvider.main)

    private val _currentUser: MutableStateFlow<AppUser?> = MutableStateFlow(null)

    private val _isAuthenticated = _currentUser.map { user -> user != null }.stateIn(
        scope = scope,
        initialValue = authStateInitializer.isUserAuthenticated(),
        started = SharingStarted.WhileSubscribed()
    )

    override val isAuthenticated: StateFlow<Boolean> = _isAuthenticated

    override fun setCurrentUser(user: AppUser?) {
        this._currentUser.update { user?.copy() }
    }

    override val currentUser: StateFlow<AppUser?> = _currentUser
}

Can you see if something is wrong with our implementation, or there is an issue with NativeFlowPublisher? We have app live from 3 weeks and we are getting huge amount of crashes in there. If You need some more details, I'm glad to provide them, as soon as it is possible.

Mutability Issue on suspend function issue with latest Ktor (2.0.0) + RxSwift wrapper

When i try to grab a response string using Ktor 2.0.0 bodyAsText it show this error

the suspend function looks like this

class Greeting {
    private val client = HttpClient()
    suspend fun getHtml(): String {
        val response = client.get("https://ktor.io/docs")
        return response.bodyAsText()
    }
}

and the error

Domain=KotlinException Code=0 "Trying to access top level value not marked as @ThreadLocal or @SharedImmutable from non-main thread" UserInfo={KotlinException=kotlin.native.IncorrectDereferenceException: Trying to access top level value not marked as @ThreadLocal or @SharedImmutable from non-main thread, NSLocalizedDescription=Trying to access top level value not marked as @ThreadLocal or @SharedImmutable from non-main thread}

Functions returning a generic Flow fail to build

From #8 (comment).

A generic function returning a Flow:

fun <T> returnGenericFlow(): Flow<T> = TODO()

fails to build with the following error:

java.lang.IllegalStateException: unexpected class parent: org.jetbrains.kotlin.types.ErrorUtils$1@819dcf1
    at org.jetbrains.kotlin.backend.konan.objcexport.ObjCExportNamerImpl.getClassOrProtocolSwiftName(ObjCExportNamer.kt:409)
    at org.jetbrains.kotlin.backend.konan.objcexport.ObjCExportNamerImpl.getClassOrProtocolName(ObjCExportNamer.kt:395)
    at org.jetbrains.kotlin.backend.konan.objcexport.ObjCExportCodeSpecKt.createCodeSpec$getType(ObjCExportCodeSpec.kt:59)
    at org.jetbrains.kotlin.backend.konan.objcexport.ObjCExportCodeSpecKt.createCodeSpec(ObjCExportCodeSpec.kt:112)
    at org.jetbrains.kotlin.backend.konan.objcexport.ObjCExport.<init>(ObjCExport.kt:42)
    ...

"Recursion detected in a lazy value" error

I'm probably missing something in how I've set this up but when I try to update project here to use the library I'm getting exception below when building in XCode (using v13 Beta 3). I've pushed changes I made so far to https://github.com/joreilly/BikeShare/tree/async_stream (right now just trying KMPNativeCoroutinesCore but hoping to update then to use new AsyncStream stuff)

This is my Podfile

target 'BikeShare' do
    platform :ios, '13.0'
    pod 'common', :path => '../../common'
    pod "SwiftUIRefresh"
    pod 'KMPNativeCoroutinesCore'
end

and this is cocoapods config in build.gradle.kts

    cocoapods {
        // Configure fields required by CocoaPods.
        summary = "BikeShare common module"
        homepage = "homepage placeholder"
        ios.deploymentTarget = "13.0"
    }
com.rickclephas.kmp.nativecoroutines.compiler.KmpNativeCoroutinesSyntheticResolveExtension.getSyntheticPropertiesNames(KmpNativeCoroutinesSyntheticResolveExtension.kt:60)
	at org.jetbrains.kotlin.resolve.extensions.SyntheticResolveExtension$Companion$getInstance$1.getSyntheticPropertiesNames(SyntheticResolveExtension.kt:58)
	at org.jetbrains.kotlin.resolve.lazy.descriptors.LazyClassMemberScope$_variableNames$2.invoke(LazyClassMemberScope.kt:127)
	at org.jetbrains.kotlin.resolve.lazy.descriptors.LazyClassMemberScope$_variableNames$2.invoke(LazyClassMemberScope.kt:124)
	at org.jetbrains.kotlin.storage.LockBasedStorageManager$LockBasedLazyValue.invoke(LockBasedStorageManager.java:408)
	at org.jetbrains.kotlin.storage.LockBasedStorageManager$LockBasedNotNullLazyValue.invoke(LockBasedStorageManager.java:527)
	at org.jetbrains.kotlin.storage.StorageKt.getValue(storage.kt:42)
	at org.jetbrains.kotlin.resolve.lazy.descriptors.LazyClassMemberScope.get_variableNames(LazyClassMemberScope.kt:124)
	at org.jetbrains.kotlin.resolve.lazy.descriptors.LazyClassMemberScope.getVariableNames(LazyClassMemberScope.kt:179)
	at org.jetbrains.kotlin.resolve.lazy.descriptors.LazyClassMemberScope$_allNames$2.invoke(LazyClassMemberScope.kt:167)
	at org.jetbrains.kotlin.resolve.lazy.descriptors.LazyClassMemberScope$_allNames$2.invoke(LazyClassMemberScope.kt:163)
	at org.jetbrains.kotlin.storage.LockBasedStorageManager$LockBasedLazyValue.invoke(LockBasedStorageManager.java:408)
	at org.jetbrains.kotlin.storage.StorageKt.getValue(storage.kt:44)
	at org.jetbrains.kotlin.resolve.lazy.descriptors.LazyClassMemberScope.get_allNames(LazyClassMemberScope.kt:163)
	at org.jetbrains.kotlin.resolve.lazy.descriptors.LazyClassMemberScope.definitelyDoesNotContainName(LazyClassMemberScope.kt:184)
	at org.jetbrains.kotlin.resolve.calls.tower.TowerResolver$Task.mayFitForName(TowerResolver.kt:265)
	at org.jetbrains.kotlin.resolve.calls.tower.TowerResolver$Task.mayFitForName(TowerResolver.kt:258)
	at org.jetbrains.kotlin.resolve.calls.tower.TowerResolver$Task.processImplicitReceiver(TowerResolver.kt:230)
	at org.jetbrains.kotlin.resolve.calls.tower.TowerResolver$Task.run$processScope(TowerResolver.kt:198)
	at org.jetbrains.kotlin.resolve.calls.tower.TowerResolver$Task.run(TowerResolver.kt:209)
	at org.jetbrains.kotlin.resolve.calls.tower.TowerResolver.run(TowerResolver.kt:99)
	at org.jetbrains.kotlin.resolve.calls.tower.TowerResolver.runResolve(TowerResolver.kt:86)
	at org.jetbrains.kotlin.resolve.calls.KotlinCallResolver.resolveCall(KotlinCallResolver.kt:75)
	at org.jetbrains.kotlin.resolve.calls.tower.PSICallResolver.runResolutionAndInference(PSICallResolver.kt:102)
	at org.jetbrains.kotlin.resolve.calls.CallResolver.doResolveCallOrGetCachedResults(CallResolver.java:602)
	at org.jetbrains.kotlin.resolve.calls.CallResolver.lambda$computeTasksAndResolveCall$0(CallResolver.java:213)
	at org.jetbrains.kotlin.util.PerformanceCounter.time(PerformanceCounter.kt:101)
	at org.jetbrains.kotlin.resolve.calls.CallResolver.computeTasksAndResolveCall(CallResolver.java:211)
	at org.jetbrains.kotlin.resolve.calls.CallResolver.computeTasksAndResolveCall(CallResolver.java:199)
	at org.jetbrains.kotlin.resolve.calls.CallResolver.resolveSimpleProperty(CallResolver.java:140)
	at org.jetbrains.kotlin.resolve.calls.CallExpressionResolver.getVariableType(CallExpressionResolver.kt:121)
	at org.jetbrains.kotlin.resolve.calls.CallExpressionResolver.getSimpleNameExpressionTypeInfo(CallExpressionResolver.kt:156)
	at org.jetbrains.kotlin.resolve.calls.CallExpressionResolver.getSimpleNameExpressionTypeInfo(CallExpressionResolver.kt:145)
	at org.jetbrains.kotlin.types.expressions.BasicExpressionTypingVisitor.visitSimpleNameExpression(BasicExpressionTypingVisitor.java:172)
	at org.jetbrains.kotlin.types.expressions.ExpressionTypingVisitorDispatcher.visitSimpleNameExpression(ExpressionTypingVisitorDispatcher.java:333)
	at org.jetbrains.kotlin.types.expressions.ExpressionTypingVisitorDispatcher$ForDeclarations.visitSimpleNameExpression(ExpressionTypingVisitorDispatcher.java:46)
	at org.jetbrains.kotlin.psi.KtNameReferenceExpression.accept(KtNameReferenceExpression.kt:59)
	at org.jetbrains.kotlin.types.expressions.ExpressionTypingVisitorDispatcher.lambda$getTypeInfo$0(ExpressionTypingVisitorDispatcher.java:175)
	at org.jetbrains.kotlin.util.PerformanceCounter.time(PerformanceCounter.kt:101)
	at org.jetbrains.kotlin.types.expressions.ExpressionTypingVisitorDispatcher.getTypeInfo(ExpressionTypingVisitorDispatcher.java:164)
	at org.jetbrains.kotlin.types.expressions.ExpressionTypingVisitorDispatcher.getTypeInfo(ExpressionTypingVisitorDispatcher.java:134)
	at org.jetbrains.kotlin.types.expressions.ExpressionTypingServices.getTypeInfo(ExpressionTypingServices.java:125)
	at org.jetbrains.kotlin.types.expressions.DoubleColonExpressionResolver.resolveExpressionOnLHS(DoubleColonExpressionResolver.kt:444)
	at org.jetbrains.kotlin.types.expressions.DoubleColonExpressionResolver.access$resolveExpressionOnLHS(DoubleColonExpressionResolver.kt:89)
	at org.jetbrains.kotlin.types.expressions.DoubleColonExpressionResolver$resolveDoubleColonLHS$resultForExpr$2.invoke(DoubleColonExpressionResolver.kt:351)
	at org.jetbrains.kotlin.types.expressions.DoubleColonExpressionResolver$resolveDoubleColonLHS$resultForExpr$2.invoke(DoubleColonExpressionResolver.kt:351)
	at org.jetbrains.kotlin.types.expressions.DoubleColonExpressionResolver.tryResolveLHS(DoubleColonExpressionResolver.kt:439)
	at org.jetbrains.kotlin.types.expressions.DoubleColonExpressionResolver.resolveDoubleColonLHS$frontend(DoubleColonExpressionResolver.kt:351)
	at org.jetbrains.kotlin.types.expressions.DoubleColonExpressionResolver.visitClassLiteralExpression(DoubleColonExpressionResolver.kt:115)
	at org.jetbrains.kotlin.types.expressions.BasicExpressionTypingVisitor.visitClassLiteralExpression(BasicExpressionTypingVisitor.java:643)
	at org.jetbrains.kotlin.types.expressions.ExpressionTypingVisitorDispatcher.visitClassLiteralExpression(ExpressionTypingVisitorDispatcher.java:368)
	at org.jetbrains.kotlin.types.expressions.ExpressionTypingVisitorDispatcher$ForDeclarations.visitClassLiteralExpression(ExpressionTypingVisitorDispatcher.java:46)
	at org.jetbrains.kotlin.psi.KtClassLiteralExpression.accept(KtClassLiteralExpression.kt:23)
	at org.jetbrains.kotlin.types.expressions.ExpressionTypingVisitorDispatcher.lambda$getTypeInfo$0(ExpressionTypingVisitorDispatcher.java:175)
	at org.jetbrains.kotlin.util.PerformanceCounter.time(PerformanceCounter.kt:101)
	at org.jetbrains.kotlin.types.expressions.ExpressionTypingVisitorDispatcher.getTypeInfo(ExpressionTypingVisitorDispatcher.java:164)
	at org.jetbrains.kotlin.types.expressions.ExpressionTypingVisitorDispatcher.getTypeInfo(ExpressionTypingVisitorDispatcher.java:134)
	at org.jetbrains.kotlin.types.expressions.ExpressionTypingServices.getTypeInfo(ExpressionTypingServices.java:125)
	at org.jetbrains.kotlin.resolve.calls.tower.PSICallResolver.resolveValueArgument(PSICallResolver.kt:769)
	at org.jetbrains.kotlin.resolve.calls.tower.PSICallResolver.resolveArgumentsInParenthesis(PSICallResolver.kt:706)
	at org.jetbrains.kotlin.resolve.calls.tower.PSICallResolver.toKotlinCall(PSICallResolver.kt:584)
	at org.jetbrains.kotlin.resolve.calls.tower.PSICallResolver.runResolutionAndInferenceForGivenCandidates(PSICallResolver.kt:130)
	at org.jetbrains.kotlin.resolve.calls.CallResolver.doResolveCallOrGetCachedResults(CallResolver.java:608)
	at org.jetbrains.kotlin.resolve.calls.CallResolver.lambda$computeTasksFromCandidatesAndResolvedCall$1(CallResolver.java:237)
	at org.jetbrains.kotlin.util.PerformanceCounter.time(PerformanceCounter.kt:101)
	at org.jetbrains.kotlin.resolve.calls.CallResolver.computeTasksFromCandidatesAndResolvedCall(CallResolver.java:233)
	at org.jetbrains.kotlin.resolve.calls.CallResolver.computeTasksFromCandidatesAndResolvedCall(CallResolver.java:223)
	at org.jetbrains.kotlin.resolve.calls.CallResolver.resolveConstructorCall(CallResolver.java:421)
	at org.jetbrains.kotlin.resolve.calls.CallResolver.resolveCallForConstructor(CallResolver.java:406)
	at org.jetbrains.kotlin.resolve.calls.CallResolver.resolveFunctionCall(CallResolver.java:334)
	at org.jetbrains.kotlin.resolve.calls.CallResolver.resolveFunctionCall(CallResolver.java:303)
	at org.jetbrains.kotlin.resolve.AnnotationResolverImpl.resolveAnnotationCall(AnnotationResolverImpl.java:161)
	at org.jetbrains.kotlin.resolve.lazy.descriptors.LazyAnnotationDescriptor$allValueArguments$2.invoke(LazyAnnotations.kt:110)
	at org.jetbrains.kotlin.resolve.lazy.descriptors.LazyAnnotationDescriptor$allValueArguments$2.invoke(LazyAnnotations.kt:109)
	at org.jetbrains.kotlin.storage.LockBasedStorageManager$LockBasedLazyValue.invoke(LockBasedStorageManager.java:408)
	at org.jetbrains.kotlin.storage.LockBasedStorageManager$LockBasedNotNullLazyValue.invoke(LockBasedStorageManager.java:527)
	at org.jetbrains.kotlin.storage.StorageKt.getValue(storage.kt:42)
	at org.jetbrains.kotlin.resolve.lazy.descriptors.LazyAnnotationDescriptor.getAllValueArguments(LazyAnnotations.kt:109)
	at org.jetbrains.kotlin.resolve.lazy.descriptors.LazyAnnotationDescriptor.forceResolveAllContents(LazyAnnotations.kt:125)
	at org.jetbrains.kotlin.resolve.lazy.ForceResolveUtil.doForceResolveAllContents(ForceResolveUtil.java:78)
	at org.jetbrains.kotlin.resolve.lazy.ForceResolveUtil.forceResolveAllContents(ForceResolveUtil.java:69)
	at org.jetbrains.kotlin.resolve.LazyTopDownAnalyzer.createFunctionDescriptors(LazyTopDownAnalyzer.kt:286)
	at org.jetbrains.kotlin.resolve.LazyTopDownAnalyzer.analyzeDeclarations(LazyTopDownAnalyzer.kt:206)
	at org.jetbrains.kotlin.resolve.LazyTopDownAnalyzer.analyzeDeclarations$default(LazyTopDownAnalyzer.kt:58)
	at org.jetbrains.kotlin.backend.konan.TopDownAnalyzerFacadeForKonan.analyzeFilesWithGivenTrace(TopDownAnalyzerFacadeForKonan.kt:94)
	at org.jetbrains.kotlin.backend.konan.TopDownAnalyzerFacadeForKonan.analyzeFiles(TopDownAnalyzerFacadeForKonan.kt:67)
	at org.jetbrains.kotlin.backend.konan.ToplevelPhasesKt$frontendPhase$1$1.invoke(ToplevelPhases.kt:86)
	at org.jetbrains.kotlin.backend.konan.ToplevelPhasesKt$frontendPhase$1$1.invoke(ToplevelPhases.kt:85)
	at org.jetbrains.kotlin.cli.common.messages.AnalyzerWithCompilerReport.analyzeAndReport(AnalyzerWithCompilerReport.kt:112)
	at org.jetbrains.kotlin.backend.konan.ToplevelPhasesKt$frontendPhase$1.invoke(ToplevelPhases.kt:85)
	at org.jetbrains.kotlin.backend.konan.ToplevelPhasesKt$frontendPhase$1.invoke(ToplevelPhases.kt:79)
	at org.jetbrains.kotlin.backend.common.phaser.PhaseBuildersKt$namedOpUnitPhase$1.invoke(PhaseBuilders.kt:97)
	at org.jetbrains.kotlin.backend.common.phaser.PhaseBuildersKt$namedOpUnitPhase$1.invoke(PhaseBuilders.kt:95)
	at org.jetbrains.kotlin.backend.common.phaser.NamedCompilerPhase.invoke(CompilerPhase.kt:94)
	at org.jetbrains.kotlin.backend.common.phaser.CompositePhase.invoke(PhaseBuilders.kt:23)
	at org.jetbrains.kotlin.backend.common.phaser.NamedCompilerPhase.invoke(CompilerPhase.kt:94)
	at org.jetbrains.kotlin.backend.common.phaser.CompilerPhaseKt.invokeToplevel(CompilerPhase.kt:41)
	at org.jetbrains.kotlin.backend.konan.KonanDriverKt.runTopLevelPhases(KonanDriver.kt:29)
	at org.jetbrains.kotlin.cli.bc.K2Native.doExecute(K2Native.kt:78)
	at org.jetbrains.kotlin.cli.bc.K2Native.doExecute(K2Native.kt:35)
	at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:88)
	at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:44)
	at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:98)
	at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:76)
	at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:45)
	at org.jetbrains.kotlin.cli.common.CLITool$Companion.doMainNoExit(CLITool.kt:227)
	at org.jetbrains.kotlin.cli.bc.K2Native$Companion$mainNoExitWithGradleRenderer$1.invoke(K2Native.kt:286)
	at org.jetbrains.kotlin.cli.bc.K2Native$Companion$mainNoExitWithGradleRenderer$1.invoke(K2Native.kt:285)
	at org.jetbrains.kotlin.util.UtilKt.profileIf(Util.kt:27)
	at org.jetbrains.kotlin.util.UtilKt.profile(Util.kt:21)
	at org.jetbrains.kotlin.cli.bc.K2Native$Companion.mainNoExitWithGradleRenderer(K2Native.kt:285)
	at org.jetbrains.kotlin.cli.bc.K2NativeKt.mainNoExitWithGradleRenderer(K2Native.kt:485)
	at org.jetbrains.kotlin.cli.utilities.MainKt$daemonMain$1.invoke(main.kt:62)
	at org.jetbrains.kotlin.cli.utilities.MainKt$daemonMain$1.invoke(main.kt:62)
	at org.jetbrains.kotlin.cli.utilities.MainKt.mainImpl(main.kt:17)
	at org.jetbrains.kotlin.cli.utilities.MainKt.daemonMain(main.kt:62)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:564)
	at org.jetbrains.kotlin.compilerRunner.KotlinToolRunner.runInProcess(KotlinToolRunner.kt:124)
	at org.jetbrains.kotlin.compilerRunner.KotlinToolRunner.run(KotlinToolRunner.kt:73)
	at org.jetbrains.kotlin.gradle.tasks.AbstractKotlinNativeCompile.compile(KotlinNativeTasks.kt:336)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:564)
	at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:104)
	at org.gradle.api.internal.project.taskfactory.StandardTaskAction.doExecute(StandardTaskAction.java:58)
	at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:51)
	at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:29)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$2.run(ExecuteActionsTaskExecuter.java:498)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:29)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:26)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:75)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:68)
	at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:153)
	at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:68)
	at org.gradle.internal.operations.DefaultBuildOperationRunner.run(DefaultBuildOperationRunner.java:56)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.lambda$run$1(DefaultBuildOperationExecutor.java:71)
	at org.gradle.internal.operations.UnmanagedBuildOperationWrapper.runWithUnmanagedSupport(UnmanagedBuildOperationWrapper.java:45)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:71)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:483)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:466)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.access$300(ExecuteActionsTaskExecuter.java:105)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$TaskExecution.executeWithPreviousOutputFiles(ExecuteActionsTaskExecuter.java:270)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$TaskExecution.execute(ExecuteActionsTaskExecuter.java:248)
	at org.gradle.internal.execution.steps.ExecuteStep.executeInternal(ExecuteStep.java:83)
	at org.gradle.internal.execution.steps.ExecuteStep.access$000(ExecuteStep.java:37)
	at org.gradle.internal.execution.steps.ExecuteStep$1.call(ExecuteStep.java:50)
	at org.gradle.internal.execution.steps.ExecuteStep$1.call(ExecuteStep.java:47)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:200)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:195)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:75)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:68)
	at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:153)
	at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:68)
	at org.gradle.internal.operations.DefaultBuildOperationRunner.call(DefaultBuildOperationRunner.java:62)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.lambda$call$2(DefaultBuildOperationExecutor.java:76)
	at org.gradle.internal.operations.UnmanagedBuildOperationWrapper.callWithUnmanagedSupport(UnmanagedBuildOperationWrapper.java:54)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:76)
	at org.gradle.internal.execution.steps.ExecuteStep.execute(ExecuteStep.java:47)
	at org.gradle.internal.execution.steps.ExecuteStep.execute(ExecuteStep.java:37)
	at org.gradle.internal.execution.steps.RemovePreviousOutputsStep.execute(RemovePreviousOutputsStep.java:68)
	at org.gradle.internal.execution.steps.RemovePreviousOutputsStep.execute(RemovePreviousOutputsStep.java:38)
	at org.gradle.internal.execution.steps.ResolveInputChangesStep.execute(ResolveInputChangesStep.java:50)
	at org.gradle.internal.execution.steps.ResolveInputChangesStep.execute(ResolveInputChangesStep.java:36)
	at org.gradle.internal.execution.steps.CancelExecutionStep.execute(CancelExecutionStep.java:41)
	at org.gradle.internal.execution.steps.TimeoutStep.executeWithoutTimeout(TimeoutStep.java:74)
	at org.gradle.internal.execution.steps.TimeoutStep.execute(TimeoutStep.java:55)
	at org.gradle.internal.execution.steps.CreateOutputsStep.execute(CreateOutputsStep.java:51)
	at org.gradle.internal.execution.steps.CreateOutputsStep.execute(CreateOutputsStep.java:29)
	at org.gradle.internal.execution.steps.CaptureStateAfterExecutionStep.execute(CaptureStateAfterExecutionStep.java:54)
	at org.gradle.internal.execution.steps.CaptureStateAfterExecutionStep.execute(CaptureStateAfterExecutionStep.java:35)
	at org.gradle.internal.execution.steps.BroadcastChangingOutputsStep.execute(BroadcastChangingOutputsStep.java:60)
	at org.gradle.internal.execution.steps.BroadcastChangingOutputsStep.execute(BroadcastChangingOutputsStep.java:27)
	at org.gradle.internal.execution.steps.BuildCacheStep.executeWithoutCache(BuildCacheStep.java:174)
	at org.gradle.internal.execution.steps.BuildCacheStep.execute(BuildCacheStep.java:74)
	at org.gradle.internal.execution.steps.BuildCacheStep.execute(BuildCacheStep.java:45)
	at org.gradle.internal.execution.steps.StoreExecutionStateStep.execute(StoreExecutionStateStep.java:40)
	at org.gradle.internal.execution.steps.StoreExecutionStateStep.execute(StoreExecutionStateStep.java:29)
	at org.gradle.internal.execution.steps.RecordOutputsStep.execute(RecordOutputsStep.java:36)
	at org.gradle.internal.execution.steps.RecordOutputsStep.execute(RecordOutputsStep.java:22)
	at org.gradle.internal.execution.steps.SkipUpToDateStep.executeBecause(SkipUpToDateStep.java:99)
	at org.gradle.internal.execution.steps.SkipUpToDateStep.lambda$execute$0(SkipUpToDateStep.java:92)
	at java.base/java.util.Optional.map(Optional.java:258)
	at org.gradle.internal.execution.steps.SkipUpToDateStep.execute(SkipUpToDateStep.java:52)
	at org.gradle.internal.execution.steps.SkipUpToDateStep.execute(SkipUpToDateStep.java:36)
	at org.gradle.internal.execution.steps.ResolveChangesStep.execute(ResolveChangesStep.java:84)
	at org.gradle.internal.execution.steps.ResolveChangesStep.execute(ResolveChangesStep.java:41)
	at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsFinishedStep.execute(MarkSnapshottingInputsFinishedStep.java:37)
	at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsFinishedStep.execute(MarkSnapshottingInputsFinishedStep.java:27)
	at org.gradle.internal.execution.steps.ResolveCachingStateStep.execute(ResolveCachingStateStep.java:91)
	at org.gradle.internal.execution.steps.ResolveCachingStateStep.execute(ResolveCachingStateStep.java:49)
	at org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.execute(CaptureStateBeforeExecutionStep.java:78)
	at org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.execute(CaptureStateBeforeExecutionStep.java:49)
	at org.gradle.internal.execution.steps.ValidateStep.execute(ValidateStep.java:105)
	at org.gradle.internal.execution.steps.ValidateStep.execute(ValidateStep.java:50)
	at org.gradle.internal.execution.steps.SkipEmptyWorkStep.lambda$execute$2(SkipEmptyWorkStep.java:86)
	at java.base/java.util.Optional.orElseGet(Optional.java:362)
	at org.gradle.internal.execution.steps.SkipEmptyWorkStep.execute(SkipEmptyWorkStep.java:86)
	at org.gradle.internal.execution.steps.SkipEmptyWorkStep.execute(SkipEmptyWorkStep.java:32)
	at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsStartedStep.execute(MarkSnapshottingInputsStartedStep.java:38)
	at org.gradle.internal.execution.steps.LoadExecutionStateStep.execute(LoadExecutionStateStep.java:43)
	at org.gradle.internal.execution.steps.LoadExecutionStateStep.execute(LoadExecutionStateStep.java:31)
	at org.gradle.internal.execution.steps.AssignWorkspaceStep.lambda$execute$0(AssignWorkspaceStep.java:40)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$TaskExecution$2.withWorkspace(ExecuteActionsTaskExecuter.java:283)
	at org.gradle.internal.execution.steps.AssignWorkspaceStep.execute(AssignWorkspaceStep.java:40)
	at org.gradle.internal.execution.steps.AssignWorkspaceStep.execute(AssignWorkspaceStep.java:30)
	at org.gradle.internal.execution.steps.IdentityCacheStep.execute(IdentityCacheStep.java:37)
	at org.gradle.internal.execution.steps.IdentityCacheStep.execute(IdentityCacheStep.java:27)
	at org.gradle.internal.execution.steps.IdentifyStep.execute(IdentifyStep.java:49)
	at org.gradle.internal.execution.steps.IdentifyStep.execute(IdentifyStep.java:35)
	at org.gradle.internal.execution.impl.DefaultExecutionEngine$1.execute(DefaultExecutionEngine.java:76)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeIfValid(ExecuteActionsTaskExecuter.java:184)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:173)
	at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:109)
	at org.gradle.api.internal.tasks.execution.FinalizePropertiesTaskExecuter.execute(FinalizePropertiesTaskExecuter.java:46)
	at org.gradle.api.internal.tasks.execution.ResolveTaskExecutionModeExecuter.execute(ResolveTaskExecutionModeExecuter.java:51)
	at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:57)
	at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:56)
	at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:36)
	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.executeTask(EventFiringTaskExecuter.java:77)
	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:55)
	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:52)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:200)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:195)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:75)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:68)
	at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:153)
	at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:68)
	at org.gradle.internal.operations.DefaultBuildOperationRunner.call(DefaultBuildOperationRunner.java:62)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.lambda$call$2(DefaultBuildOperationExecutor.java:76)
	at org.gradle.internal.operations.UnmanagedBuildOperationWrapper.callWithUnmanagedSupport(UnmanagedBuildOperationWrapper.java:54)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:76)
	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:52)
	at org.gradle.execution.plan.LocalTaskNodeExecutor.execute(LocalTaskNodeExecutor.java:74)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:408)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:395)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:388)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:374)
	at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.lambda$run$0(DefaultPlanExecutor.java:127)
	at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.execute(DefaultPlanExecutor.java:191)
	at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.executeNextNode(DefaultPlanExecutor.java:182)
	at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.run(DefaultPlanExecutor.java:124)
	at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
	at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
	at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
	at java.base/java.lang.Thread.run(Thread.java:832)
Caused by: java.lang.AssertionError: Recursion detected in a lazy value under LockBasedStorageManager@73778406 (TopDownAnalyzer for Konan)
	at org.jetbrains.kotlin.resolve.lazy.descriptors.LazyClassMemberScope.get_allNames(LazyClassMemberScope.kt:163)
	at org.jetbrains.kotlin.resolve.lazy.descriptors.LazyClassMemberScope.definitelyDoesNotContainName(LazyClassMemberScope.kt:184)
	at org.jetbrains.kotlin.resolve.calls.tower.TowerResolver$Task.mayFitForName(TowerResolver.kt:265)
	at org.jetbrains.kotlin.resolve.calls.tower.TowerResolver$Task.mayFitForName(TowerResolver.kt:258)
	at org.jetbrains.kotlin.resolve.calls.tower.TowerResolver$Task.processImplicitReceiver(TowerResolver.kt:230)
	at org.jetbrains.kotlin.resolve.calls.tower.TowerResolver$Task.run$processScope(TowerResolver.kt:198)
	at org.jetbrains.kotlin.resolve.calls.tower.TowerResolver$Task.run(TowerResolver.kt:209)
	at org.jetbrains.kotlin.resolve.calls.tower.TowerResolver.run(TowerResolver.kt:99)
	at org.jetbrains.kotlin.resolve.calls.tower.TowerResolver.runResolve(TowerResolver.kt:86)
	at org.jetbrains.kotlin.resolve.calls.KotlinCallResolver.resolveCall(KotlinCallResolver.kt:75)
	at org.jetbrains.kotlin.resolve.calls.tower.PSICallResolver.runResolutionAndInference(PSICallResolver.kt:102)
	at org.jetbrains.kotlin.resolve.calls.CallResolver.doResolveCallOrGetCachedResults(CallResolver.java:602)
	at org.jetbrains.kotlin.resolve.calls.CallResolver.lambda$computeTasksAndResolveCall$0(CallResolver.java:213)
	at org.jetbrains.kotlin.util.PerformanceCounter.time(PerformanceCounter.kt:101)
	at org.jetbrains.kotlin.resolve.calls.CallResolver.computeTasksAndResolveCall(CallResolver.java:211)
	at org.jetbrains.kotlin.resolve.calls.CallResolver.computeTasksAndResolveCall(CallResolver.java:199)
	at org.jetbrains.kotlin.resolve.calls.CallResolver.resolveFunctionCall(CallResolver.java:329)
	at org.jetbrains.kotlin.resolve.calls.CallExpressionResolver.getResolvedCallForFunction(CallExpressionResolver.kt:98)
	at org.jetbrains.kotlin.resolve.calls.CallExpressionResolver.getCallExpressionTypeInfoWithoutFinalTypeCheck(CallExpressionResolver.kt:220)
	at org.jetbrains.kotlin.resolve.calls.CallExpressionResolver.getCallExpressionTypeInfo(CallExpressionResolver.kt:197)
	at org.jetbrains.kotlin.types.expressions.BasicExpressionTypingVisitor.visitCallExpression(BasicExpressionTypingVisitor.java:701)
	at org.jetbrains.kotlin.types.expressions.ExpressionTypingVisitorDispatcher.visitCallExpression(ExpressionTypingVisitorDispatcher.java:388)
	at org.jetbrains.kotlin.types.expressions.ExpressionTypingVisitorDispatcher$ForDeclarations.visitCallExpression(ExpressionTypingVisitorDispatcher.java:46)
	at org.jetbrains.kotlin.psi.KtCallExpression.accept(KtCallExpression.java:35)
	at org.jetbrains.kotlin.types.expressions.ExpressionTypingVisitorDispatcher.lambda$getTypeInfo$0(ExpressionTypingVisitorDispatcher.java:175)
	... 293 more


FAILURE: Build failed with an exception.

Add Apple Silicon targets

It'd be great to add the following targets:

iosSimulatorArm64()
macosArm64()
tvosSimulatorArm64()
watchosSimulatorArm64()

Looks like we are currently blocked by kotlinx-datetime.

Exceptions in Kotlin seem to be completing successfully in Swift

I ran into a bit of a strange issue.

I have this method in my shared module, that doesn't return anything because there is no useful data to return and throws an exception in the event of an error (in Android I'm just using the server error code to determine what went wrong):

@Throws(Exception::class)
suspend fun verifyPhoneNumber(country: String, number: String) =
    verifyRepository.verifyPhoneNumber(country, number)

When I call this from Swift, it always returns .success regardless of if an exception was thrown.

I'm running from Swift:

let result = await asyncResult(for: verifyNumber.verifyPhoneNumberNative(country: country, number: number))
print(result)

And the logs from the simulator from Ktor/last line from the print statement:

HttpClient: RESPONSE: 429 Too Many Requests
METHOD: HttpMethod(value=POST)
FROM: https://****
COMMON HEADERS
-> Content-Length: 48
-> Content-Type: application/json
-> Date: Mon, 26 Dec 2022 10:19:54 GMT
-> Strict-Transport-Security: max-age=15724800; includeSubDomains
BODY Content-Type: application/json
BODY START
{"status_code":429,"error":"Too Many Requests"}
BODY END
success(kotlin.Unit)

Could this be a bug, or is it an implementation issue?
I appreciate I can refactor the shared module code to produce a useful result other than Unit and that'll solve the problem, but thought it might be worth raising it incase I hit a bug.
Also my first time building an iOS app so likely I'm doing something wrong ๐Ÿ˜„

[Help] How to implement KotlinSuspendFunction1 in Swift?

Hey! Awesome library. QQ - How to implement KotlinSuspendFunction1 in Swift?

Kotlin function signature:

    fun <T: Cacheable> sync(
        key: String,
        getFromRemote: suspend (key: String) -> Result<T, Exception>,
        onCompletion: (Result<*, Exception>) -> Unit = {}
    )

Swift usage:

    init () {
        treeSquirrel.sync(key: KEY, getFromRemote: <#T##KotlinSuspendFunction1#> , onCompletion: { result in
            self.onCompletion(result: result)
        } )
    }

Swift callback I want to pass in treeSquirrel.sync():

func getFromRemote(){
        Task {
            do {
                let response = await asyncResult(for: api.fetchNative(url: URL))
                
                guard case let .success(result) = response else { return }

                let model = try? JSONDecoder().decode(
                    Model.self,
                    from: result.data(using: .utf8)!
                )
                
                self.result = Model(id: model.id)  
            } 
        }
    }

Compilation fails with NoSuchElementException for functions with generic parameters

Hello ๐Ÿ‘‹๐Ÿป I got this error and it only happens when I try to run any test. here's the message:

e: Compilation failed: Sequence contains no element matching the predicate.
 * Source files: *all files in commonTest are mentioned here*
 * Compiler version info: Konan: 1.5.20 / Kotlin: 1.5.20
 * Output kind: LIBRARY
e: java.util.NoSuchElementException: Sequence contains no element matching the predicate.
	at com.rickclephas.kmp.nativecoroutines.compiler.KmpNativeCoroutinesIrTransformer.visitFunctionNew(KmpNativeCoroutinesIrTransformer.kt:232)
	at org.jetbrains.kotlin.backend.common.IrElementTransformerVoidWithContext.visitFunction(IrElementTransformerVoidWithContext.kt:68)
	at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitSimpleFunction(IrElementTransformerVoid.kt:72)
	at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitSimpleFunction(IrElementTransformerVoid.kt:73)

After some debugging, I finally found the one that triggers it: this file from Apollo GraphQL. I added it manually to my commonTest in my project.

Based on the error message, is it because single in visitFunctionNew can't find any matching function? but if that's true, I'm not sure why it doesn't match.

val originalFunction = declaration.parentAsClass.functions.single {
            it.name == originalName && it.isCoroutinesFunction && it.valueParameters.areSameAs(declaration.valueParameters)
        }

InvalidMutabilityException with code similar to RandomLettersGenerator

Iโ€™m fairly new to iOS and Kotlin Multiplatform. I have a little app with Android and iOS targets here:
https://bitbucket.org/herrbert74_szinti/funquiz/src/main/
I tried to add a use case with a suspended function to the shared code. It's fairly similar to the RandomLettersGenerator example:
https://bitbucket.org/herrbert74_szinti/funquiz/src/main/shared/src/commonMain/kotlin/com/babestudios/shared/domain/usecase/game/InitGameUseCase.kt
Now, I want to use it in a ViewModel on the iOS side, but whatever I try, the whole class is frozen (I think). It fails with an InvalidMutabilityException, when I try to mutate the GameState. It happens here:
https://bitbucket.org/herrbert74_szinti/funquiz/src/main/iosApp/FunQuiz/Features/Game/GameViewModel.swift
What can I do to avoid freezing the state? Can I prevent the freezing or can I copy the state somehow into a mutable version?

Couple of issues with SPM

Thanks for adding SPM support!

It works great locally but fails on CI as the repo url seems to be only available with ssh:

image
Is it possible to support https as well which I think is what most packages do?

The other thing I noticed is XCode always adds the RxSwift transitive dependency even when I've only added the KMPNativeCoroutinesCombine library. Not sure if there's anything you can do here as I see in the Package.swift you've only added the RxSwift dependency to the KMPNativeCoroutinesRxSwift target?

Gradle plugin causes :shared:compileKotlinIos type checker to fail.

I'm on Kotlin 1.5.10, with plugin version 0.4.1-kotlin-1.5.10

When I add the plugin to my shared project gradle file build fails with:

Type checking has run into a recursive problem. Easiest workaround: specify types of your declarations explicitly

This happens in a Logger interface that I have in the common source:

abstract class Logger {
    open fun isLoggable(severity: Severity): Boolean = true

    abstract fun log(severity: Severity, message: String, tag: String, throwable: Throwable? = null)

    open fun v(message: String, tag: String, throwable: Throwable? = null) =
        log(Severity.Verbose, message, tag, throwable)

    open fun d(message: String, tag: String, throwable: Throwable? = null) =
        log(Severity.Debug, message, tag, throwable)

    open fun i(message: String, tag: String, throwable: Throwable? = null) =
        log(Severity.Info, message, tag, throwable)

    open fun w(message: String, tag: String, throwable: Throwable? = null) =
        log(Severity.Warn, message, tag, throwable)

    open fun e(message: String, tag: String, throwable: Throwable? = null) =
        log(Severity.Error, message, tag, throwable)

    open fun wtf(message: String, tag: String, throwable: Throwable? = null) =
        log(Severity.Assert, message, tag, throwable)
}

It shows the same error for each of the functions in the class.

If I remove the plugin, everything works correctly. If I add the : Unit return types like the error message suggests, it still fails.

I don't see anything particular on the stacktrace, but here it is anyway:

Gradle stacktrace
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':shared:compileKotlinIos'.
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.lambda$executeIfValid$1(ExecuteActionsTaskExecuter.java:187)
        at org.gradle.internal.Try$Failure.ifSuccessfulOrElse(Try.java:268)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeIfValid(ExecuteActionsTaskExecuter.java:185)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:173)
        at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:109)
        at org.gradle.api.internal.tasks.execution.FinalizePropertiesTaskExecuter.execute(FinalizePropertiesTaskExecuter.java:46)
        at org.gradle.api.internal.tasks.execution.ResolveTaskExecutionModeExecuter.execute(ResolveTaskExecutionModeExecuter.java:51)
        at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:57)
        at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:56)
        at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:36)
        at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.executeTask(EventFiringTaskExecuter.java:77)
        at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:55)
        at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:52)
        at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:200)
        at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:195)
        at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:75)
        at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:68)
        at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:153)
        at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:68)
        at org.gradle.internal.operations.DefaultBuildOperationRunner.call(DefaultBuildOperationRunner.java:62)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.lambda$call$2(DefaultBuildOperationExecutor.java:76)
        at org.gradle.internal.operations.UnmanagedBuildOperationWrapper.callWithUnmanagedSupport(UnmanagedBuildOperationWrapper.java:54)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:76)
        at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:52)
        at org.gradle.execution.plan.LocalTaskNodeExecutor.execute(LocalTaskNodeExecutor.java:74)
        at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:408)
        at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:395)
        at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:388)
        at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:374)
        at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.lambda$run$0(DefaultPlanExecutor.java:127)
        at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.execute(DefaultPlanExecutor.java:191)
        at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.executeNextNode(DefaultPlanExecutor.java:182)
        at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.run(DefaultPlanExecutor.java:124)
        at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
        at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
        at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
Caused by: org.jetbrains.kotlin.backend.konan.KonanCompilationException: Compilation finished with errors
        at org.jetbrains.kotlin.cli.bc.K2Native$Companion$mainNoExitWithGradleRenderer$1.invoke(K2Native.kt:287)
        at org.jetbrains.kotlin.cli.bc.K2Native$Companion$mainNoExitWithGradleRenderer$1.invoke(K2Native.kt:285)
        at org.jetbrains.kotlin.util.UtilKt.profileIf(Util.kt:27)
        at org.jetbrains.kotlin.util.UtilKt.profile(Util.kt:21)
        at org.jetbrains.kotlin.cli.bc.K2Native$Companion.mainNoExitWithGradleRenderer(K2Native.kt:285)
        at org.jetbrains.kotlin.cli.bc.K2NativeKt.mainNoExitWithGradleRenderer(K2Native.kt:485)
        at org.jetbrains.kotlin.cli.utilities.MainKt$daemonMain$1.invoke(main.kt:62)
        at org.jetbrains.kotlin.cli.utilities.MainKt$daemonMain$1.invoke(main.kt:62)
        at org.jetbrains.kotlin.cli.utilities.MainKt.mainImpl(main.kt:17)
        at org.jetbrains.kotlin.cli.utilities.MainKt.daemonMain(main.kt:62)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at org.jetbrains.kotlin.compilerRunner.KotlinToolRunner.runInProcess(KotlinToolRunner.kt:124)
        at org.jetbrains.kotlin.compilerRunner.KotlinToolRunner.run(KotlinToolRunner.kt:73)
        at org.jetbrains.kotlin.gradle.tasks.AbstractKotlinNativeCompile.compile(KotlinNativeTasks.kt:336)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:104)
        at org.gradle.api.internal.project.taskfactory.StandardTaskAction.doExecute(StandardTaskAction.java:58)
        at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:51)
        at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:29)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$2.run(ExecuteActionsTaskExecuter.java:498)
        at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:29)
        at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:26)
        at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:75)
        at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:68)
        at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:153)
        at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:68)
        at org.gradle.internal.operations.DefaultBuildOperationRunner.run(DefaultBuildOperationRunner.java:56)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.lambda$run$1(DefaultBuildOperationExecutor.java:71)
        at org.gradle.internal.operations.UnmanagedBuildOperationWrapper.runWithUnmanagedSupport(UnmanagedBuildOperationWrapper.java:45)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:71)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:483)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:466)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.access$300(ExecuteActionsTaskExecuter.java:105)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$TaskExecution.executeWithPreviousOutputFiles(ExecuteActionsTaskExecuter.java:270)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$TaskExecution.execute(ExecuteActionsTaskExecuter.java:248)
        at org.gradle.internal.execution.steps.ExecuteStep.executeInternal(ExecuteStep.java:83)
        at org.gradle.internal.execution.steps.ExecuteStep.access$000(ExecuteStep.java:37)
        at org.gradle.internal.execution.steps.ExecuteStep$1.call(ExecuteStep.java:50)
        at org.gradle.internal.execution.steps.ExecuteStep$1.call(ExecuteStep.java:47)
        at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:200)
        at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:195)
        at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:75)
        at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:68)
        at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:153)
        at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:68)
        at org.gradle.internal.operations.DefaultBuildOperationRunner.call(DefaultBuildOperationRunner.java:62)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.lambda$call$2(DefaultBuildOperationExecutor.java:76)
        at org.gradle.internal.operations.UnmanagedBuildOperationWrapper.callWithUnmanagedSupport(UnmanagedBuildOperationWrapper.java:54)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:76)
        at org.gradle.internal.execution.steps.ExecuteStep.execute(ExecuteStep.java:47)
        at org.gradle.internal.execution.steps.ExecuteStep.execute(ExecuteStep.java:37)
        at org.gradle.internal.execution.steps.RemovePreviousOutputsStep.execute(RemovePreviousOutputsStep.java:68)
        at org.gradle.internal.execution.steps.RemovePreviousOutputsStep.execute(RemovePreviousOutputsStep.java:38)
        at org.gradle.internal.execution.steps.ResolveInputChangesStep.execute(ResolveInputChangesStep.java:50)
        at org.gradle.internal.execution.steps.ResolveInputChangesStep.execute(ResolveInputChangesStep.java:36)
        at org.gradle.internal.execution.steps.CancelExecutionStep.execute(CancelExecutionStep.java:41)
        at org.gradle.internal.execution.steps.TimeoutStep.executeWithoutTimeout(TimeoutStep.java:74)
        at org.gradle.internal.execution.steps.TimeoutStep.execute(TimeoutStep.java:55)
        at org.gradle.internal.execution.steps.CreateOutputsStep.execute(CreateOutputsStep.java:51)
        at org.gradle.internal.execution.steps.CreateOutputsStep.execute(CreateOutputsStep.java:29)
        at org.gradle.internal.execution.steps.CaptureStateAfterExecutionStep.execute(CaptureStateAfterExecutionStep.java:54)
        at org.gradle.internal.execution.steps.CaptureStateAfterExecutionStep.execute(CaptureStateAfterExecutionStep.java:35)
        at org.gradle.internal.execution.steps.BroadcastChangingOutputsStep.execute(BroadcastChangingOutputsStep.java:60)
        at org.gradle.internal.execution.steps.BroadcastChangingOutputsStep.execute(BroadcastChangingOutputsStep.java:27)
        at org.gradle.internal.execution.steps.BuildCacheStep.executeWithoutCache(BuildCacheStep.java:174)
        at org.gradle.internal.execution.steps.BuildCacheStep.executeAndStoreInCache(BuildCacheStep.java:150)
        at org.gradle.internal.execution.steps.BuildCacheStep.lambda$executeWithCache$2(BuildCacheStep.java:124)
        at org.gradle.internal.execution.steps.BuildCacheStep.lambda$executeWithCache$3(BuildCacheStep.java:124)
        at org.gradle.internal.Try$Success.map(Try.java:162)
        at org.gradle.internal.execution.steps.BuildCacheStep.executeWithCache(BuildCacheStep.java:83)
        at org.gradle.internal.execution.steps.BuildCacheStep.execute(BuildCacheStep.java:73)
        at org.gradle.internal.execution.steps.BuildCacheStep.execute(BuildCacheStep.java:45)
        at org.gradle.internal.execution.steps.StoreExecutionStateStep.execute(StoreExecutionStateStep.java:40)
        at org.gradle.internal.execution.steps.StoreExecutionStateStep.execute(StoreExecutionStateStep.java:29)
        at org.gradle.internal.execution.steps.RecordOutputsStep.execute(RecordOutputsStep.java:36)
        at org.gradle.internal.execution.steps.RecordOutputsStep.execute(RecordOutputsStep.java:22)
        at org.gradle.internal.execution.steps.SkipUpToDateStep.executeBecause(SkipUpToDateStep.java:99)
        at org.gradle.internal.execution.steps.SkipUpToDateStep.lambda$execute$0(SkipUpToDateStep.java:92)
        at org.gradle.internal.execution.steps.SkipUpToDateStep.execute(SkipUpToDateStep.java:52)
        at org.gradle.internal.execution.steps.SkipUpToDateStep.execute(SkipUpToDateStep.java:36)
        at org.gradle.internal.execution.steps.ResolveChangesStep.execute(ResolveChangesStep.java:84)
        at org.gradle.internal.execution.steps.ResolveChangesStep.execute(ResolveChangesStep.java:41)
        at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsFinishedStep.execute(MarkSnapshottingInputsFinishedStep.java:37)
        at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsFinishedStep.execute(MarkSnapshottingInputsFinishedStep.java:27)
        at org.gradle.internal.execution.steps.ResolveCachingStateStep.execute(ResolveCachingStateStep.java:91)
        at org.gradle.internal.execution.steps.ResolveCachingStateStep.execute(ResolveCachingStateStep.java:49)
        at org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.execute(CaptureStateBeforeExecutionStep.java:78)
        at org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.execute(CaptureStateBeforeExecutionStep.java:49)
        at org.gradle.internal.execution.steps.ValidateStep.execute(ValidateStep.java:105)
        at org.gradle.internal.execution.steps.ValidateStep.execute(ValidateStep.java:50)
        at org.gradle.internal.execution.steps.SkipEmptyWorkStep.lambda$execute$2(SkipEmptyWorkStep.java:86)
        at org.gradle.internal.execution.steps.SkipEmptyWorkStep.execute(SkipEmptyWorkStep.java:86)
        at org.gradle.internal.execution.steps.SkipEmptyWorkStep.execute(SkipEmptyWorkStep.java:32)
        at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsStartedStep.execute(MarkSnapshottingInputsStartedStep.java:38)
        at org.gradle.internal.execution.steps.LoadExecutionStateStep.execute(LoadExecutionStateStep.java:43)
        at org.gradle.internal.execution.steps.LoadExecutionStateStep.execute(LoadExecutionStateStep.java:31)
        at org.gradle.internal.execution.steps.AssignWorkspaceStep.lambda$execute$0(AssignWorkspaceStep.java:40)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$TaskExecution$2.withWorkspace(ExecuteActionsTaskExecuter.java:283)
        at org.gradle.internal.execution.steps.AssignWorkspaceStep.execute(AssignWorkspaceStep.java:40)
        at org.gradle.internal.execution.steps.AssignWorkspaceStep.execute(AssignWorkspaceStep.java:30)
        at org.gradle.internal.execution.steps.IdentityCacheStep.execute(IdentityCacheStep.java:37)
        at org.gradle.internal.execution.steps.IdentityCacheStep.execute(IdentityCacheStep.java:27)
        at org.gradle.internal.execution.steps.IdentifyStep.execute(IdentifyStep.java:49)
        at org.gradle.internal.execution.steps.IdentifyStep.execute(IdentifyStep.java:35)
        at org.gradle.internal.execution.impl.DefaultExecutionEngine$1.execute(DefaultExecutionEngine.java:76)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeIfValid(ExecuteActionsTaskExecuter.java:184)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:173)
        at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:109)
        at org.gradle.api.internal.tasks.execution.FinalizePropertiesTaskExecuter.execute(FinalizePropertiesTaskExecuter.java:46)
        at org.gradle.api.internal.tasks.execution.ResolveTaskExecutionModeExecuter.execute(ResolveTaskExecutionModeExecuter.java:51)
        at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:57)
        at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:56)
        at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:36)
        at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.executeTask(EventFiringTaskExecuter.java:77)
        at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:55)
        at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:52)
        at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:200)
        at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:195)
        at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:75)
        at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:68)
        at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:153)
        at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:68)
        at org.gradle.internal.operations.DefaultBuildOperationRunner.call(DefaultBuildOperationRunner.java:62)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.lambda$call$2(DefaultBuildOperationExecutor.java:76)
        at org.gradle.internal.operations.UnmanagedBuildOperationWrapper.callWithUnmanagedSupport(UnmanagedBuildOperationWrapper.java:54)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:76)
        at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:52)
        at org.gradle.execution.plan.LocalTaskNodeExecutor.execute(LocalTaskNodeExecutor.java:74)
        at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:408)
        at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:395)
        at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:388)
        at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:374)
        at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.lambda$run$0(DefaultPlanExecutor.java:127)
        at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.execute(DefaultPlanExecutor.java:191)
        at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.executeNextNode(DefaultPlanExecutor.java:182)
        at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.run(DefaultPlanExecutor.java:124)
        at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
        at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
        at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)

Exception in KmpNativeCoroutinesSyntheticResolveExtension.getDeclarations

Hello, thanks for that great library.

After updating the library version to 0.10.0-new-mm, I got a compilation issue.
During compilation when it faces @OptIn(ExperimentalTime::class) annotation in my code it throws ClassCastException.

Stacktrace:

Caused by: java.lang.ClassCastException: class java.util.ArrayList cannot be cast to class java.util.Set (java.util.ArrayList and java.util.Set are in module java.base of loader 'bootstrap')
   at com.rickclephas.kmp.nativecoroutines.compiler.KmpNativeCoroutinesSyntheticResolveExtension.getDeclarations(KmpNativeCoroutinesSyntheticResolveExtension.kt:33)
   at com.rickclephas.kmp.nativecoroutines.compiler.KmpNativeCoroutinesSyntheticResolveExtension.getDeclaredProperties(KmpNativeCoroutinesSyntheticResolveExtension.kt:54)
   at com.rickclephas.kmp.nativecoroutines.compiler.KmpNativeCoroutinesSyntheticResolveExtension.getSyntheticPropertiesNames(KmpNativeCoroutinesSyntheticResolveExtension.kt:58)
   at org.jetbrains.kotlin.resolve.extensions.SyntheticResolveExtension$Companion$getInstance$1.getSyntheticPropertiesNames(SyntheticResolveExtension.kt:57)
   at org.jetbrains.kotlin.resolve.lazy.descriptors.LazyClassMemberScope$_variableNames$2.invoke(LazyClassMemberScope.kt:127)
   at org.jetbrains.kotlin.resolve.lazy.descriptors.LazyClassMemberScope$_variableNames$2.invoke(LazyClassMemberScope.kt:124)
   at org.jetbrains.kotlin.storage.LockBasedStorageManager$LockBasedLazyValue.invoke(LockBasedStorageManager.java:408)
   at org.jetbrains.kotlin.storage.LockBasedStorageManager$LockBasedNotNullLazyValue.invoke(LockBasedStorageManager.java:527)
   at org.jetbrains.kotlin.storage.StorageKt.getValue(storage.kt:42)
   at org.jetbrains.kotlin.resolve.lazy.descriptors.LazyClassMemberScope.get_variableNames(LazyClassMemberScope.kt:124)
   at org.jetbrains.kotlin.resolve.lazy.descriptors.LazyClassMemberScope.getVariableNames(LazyClassMemberScope.kt:179)
   at org.jetbrains.kotlin.resolve.lazy.descriptors.LazyClassMemberScope$_allNames$2.invoke(LazyClassMemberScope.kt:167)
   at org.jetbrains.kotlin.resolve.lazy.descriptors.LazyClassMemberScope$_allNames$2.invoke(LazyClassMemberScope.kt:163)
   at org.jetbrains.kotlin.storage.LockBasedStorageManager$LockBasedLazyValue.invoke(LockBasedStorageManager.java:408)
   at org.jetbrains.kotlin.storage.StorageKt.getValue(storage.kt:44)
   at org.jetbrains.kotlin.resolve.lazy.descriptors.LazyClassMemberScope.get_allNames(LazyClassMemberScope.kt:163)
   at org.jetbrains.kotlin.resolve.lazy.descriptors.LazyClassMemberScope.definitelyDoesNotContainName(LazyClassMemberScope.kt:184)
   at org.jetbrains.kotlin.resolve.calls.tower.TowerResolver$Task.mayFitForName(TowerResolver.kt:265)
   at org.jetbrains.kotlin.resolve.calls.tower.TowerResolver$Task.mayFitForName(TowerResolver.kt:258)
   at org.jetbrains.kotlin.resolve.calls.tower.TowerResolver$Task.processImplicitReceiver(TowerResolver.kt:230)
   at org.jetbrains.kotlin.resolve.calls.tower.TowerResolver$Task.run$processScope(TowerResolver.kt:198)
   at org.jetbrains.kotlin.resolve.calls.tower.TowerResolver$Task.run(TowerResolver.kt:209)
   at org.jetbrains.kotlin.resolve.calls.tower.TowerResolver.run(TowerResolver.kt:99)
   at org.jetbrains.kotlin.resolve.calls.tower.TowerResolver.runResolve(TowerResolver.kt:86)
   at org.jetbrains.kotlin.resolve.calls.KotlinCallResolver.resolveCall(KotlinCallResolver.kt:75)
   at org.jetbrains.kotlin.resolve.calls.tower.PSICallResolver.runResolutionAndInference(PSICallResolver.kt:101)
   at org.jetbrains.kotlin.resolve.calls.CallResolver.doResolveCallOrGetCachedResults(CallResolver.java:601)
   at org.jetbrains.kotlin.resolve.calls.CallResolver.lambda$computeTasksAndResolveCall$0(CallResolver.java:213)
   at org.jetbrains.kotlin.util.PerformanceCounter.time(PerformanceCounter.kt:101)
   at org.jetbrains.kotlin.resolve.calls.CallResolver.computeTasksAndResolveCall(CallResolver.java:211)
   at org.jetbrains.kotlin.resolve.calls.CallResolver.computeTasksAndResolveCall(CallResolver.java:199)
   at org.jetbrains.kotlin.resolve.calls.CallResolver.resolveSimpleProperty(CallResolver.java:140)
   at org.jetbrains.kotlin.resolve.calls.CallExpressionResolver.getVariableType(CallExpressionResolver.kt:111)
   at org.jetbrains.kotlin.resolve.calls.CallExpressionResolver.getSimpleNameExpressionTypeInfo(CallExpressionResolver.kt:146)
   at org.jetbrains.kotlin.resolve.calls.CallExpressionResolver.getSimpleNameExpressionTypeInfo(CallExpressionResolver.kt:135)
   at org.jetbrains.kotlin.types.expressions.BasicExpressionTypingVisitor.visitSimpleNameExpression(BasicExpressionTypingVisitor.java:172)
   at org.jetbrains.kotlin.types.expressions.ExpressionTypingVisitorDispatcher.visitSimpleNameExpression(ExpressionTypingVisitorDispatcher.java:333)
   at org.jetbrains.kotlin.types.expressions.ExpressionTypingVisitorDispatcher$ForDeclarations.visitSimpleNameExpression(ExpressionTypingVisitorDispatcher.java:46)
   at org.jetbrains.kotlin.psi.KtNameReferenceExpression.accept(KtNameReferenceExpression.kt:59)
   at org.jetbrains.kotlin.types.expressions.ExpressionTypingVisitorDispatcher.lambda$getTypeInfo$0(ExpressionTypingVisitorDispatcher.java:175)
   ... 212 more

Kotlin version: 1.6.10.

Error with asyncStream(for: ) for Flow return function

I am currently experimenting KMM with swift's new concurrency feature (async-await) with this library and I always failed using asyncStream, it showed an error like this

Cannot convert value of type '(@escaping ([Manga], KotlinUnit) -> KotlinUnit, @escaping (Error?, KotlinUnit) -> KotlinUnit) -> () -> KotlinUnit' to expected argument type '[Manga]'

BrowseUseCase.kt

override suspend fun getTrendingManga(): Flow<List<Manga>> {
        return flow {
            try {
                val response = repository.getTrendingManga().map()
                emit(response)
            } catch (e: ApiException) {
                throw ApiError(e.errorTitle, e.errorMessage)
            } catch (e: Throwable) {
                throw e
            }
        }
    }

BrowseViewModel.swift

 func fetchTrendingManga() {
    Task {
      trendingManga = .loading
      do {
        let stream = asyncStream(for: browseUseCase.getTrendingMangaNative())
        for try await data in stream {
          trendingManga = .success(data: data)
        }
      } catch {
        trendingManga = .error(error: error)
      }
    }
  }

my project repo:
https://github.com/uwaisalqadri/MangaKu

am I doing it wrong? sorry for the interruption and thanks for your attention

Use Method from a lazily initialised class in `asyncStream`

Hi,
first of all amazing library and thanks for creating and maintaining ist.

I'm injecting a shared class instance through Koin in SwiftUI. That class has a MutabelStateFlow which I want to collect in Swift, preferably through async/await.
But since the injected class is lazy it get the compiler error Cannot use mutating getter on immutable value: 'self' is immutable.
Do you know if it's somehow possible to use a lazily initialised variable for the asyncStream function. Maybe you already encountered this problem?

struct ToastView: View {
    @LazyKoin private var queue: ToastQueue

    @State var toast: shared.Toast? = nil
    
    var body: some View {
        VStack {
            ...
        }
        .task {
            do {
                let stream = asyncStream(for: queue.currentToastNative)
                for try await toast in stream {
                    self.toast = toast
                    print("Got toast : \(toast)")
                }
            } catch {
                print("Failed with error: \(error)")
            }
        }
    } 

Kotlin compiler plugin isn't applied when using embeddable compiler jars

I had build.gradle.kts

id("com.rickclephas.kmp.nativecoroutines") version("0.12.2-new-mm")
....
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.21")
classpath("org.jetbrains.kotlin:kotlin-serialization:1.6.21")

When I upgraded build.gradle.kts to

id("com.rickclephas.kmp.nativecoroutines") version("0.12.3-new-mm")
....
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.0")
classpath("org.jetbrains.kotlin:kotlin-serialization:1.7.0")

My KMM Library build is ok but Xcode project can't find native functions.

error: value of type 'SharedRepository' has no member 'getDisplayStringsNative'

Generating code for transitive dependency

Thanks for the great library!

I was playing with the Compiler plugin and realized it won't generate the NativeFlow and nativeSuspend for Flow or suspend fun that come from a transitive dependency / 3rd party library.

A third party library has the following class:

abstract Store<S : Any> {
  val state: Flow<S> = ...
}

I extend this abstract class from my KMP module:

class MyStore : Store<State> {
  ...
}

With this the nativecoroutines plugin won't generate myStore.stateNative.

I wonder if the compiler plugin can also generate code for the APIs exposed by the module?

Converting a suspend function to call it later

In Swift, I have a struct with an async func as property:

public struct Test {
    public var randomLetters: @Sendable () async throws -> String
}

Is it possible to create a Test instance using something like the asyncFunction(for:) function?

Imagine I'd like to write code like this:

let test = Test(randomLetters: {
    return __asyncFunction(for: randomLettersGenerator.getRandomLettersNative())
})

which would allow me to call test.randomLetters() at some later point.

Compilation fails for functions with default argument values

Hello, thank you so much for the library! ๐Ÿ™‡๐Ÿปโ€โ™€๏ธ

I couldn't compile my project with this plugin recently and after some debugging I found that it's caused by default value in a param of a suspend function, for example:

interface SearchRepository {
    suspend fun search(
        keyword: String,
        page: Int = 0
    ): SearchItem
}

The project can compile if I remove all of the default values.

I'm using following setup:

Plugin version: 0.4.2
Kotlin version: 1.5.20
Coroutines: 1.5.0-native-mt

It's failed when executing linkDebugFrameworkIosX64 and got following message:

Full Gradle Stacktrace

 * Source files: 
 * Compiler version info: Konan: 1.5.20 / Kotlin: 1.5.20
 * Output kind: FRAMEWORK

e: java.lang.IllegalArgumentException: IrErrorExpression(-2, -2, "Default Argument Value stub for page|2") found but error code is not allowed
	at org.jetbrains.kotlin.backend.common.serialization.IrBodyDeserializer.deserializeErrorExpression(IrBodyDeserializer.kt:341)
	at org.jetbrains.kotlin.backend.common.serialization.IrBodyDeserializer.deserializeOperation(IrBodyDeserializer.kt:802)
	at org.jetbrains.kotlin.backend.common.serialization.IrBodyDeserializer.deserializeExpression(IrBodyDeserializer.kt:813)
	at org.jetbrains.kotlin.backend.common.serialization.IrDeclarationDeserializer.deserializeExpressionBody(IrDeclarationDeserializer.kt:449)
	at org.jetbrains.kotlin.backend.common.serialization.IrDeclarationDeserializer.deserializeIrValueParameter(IrDeclarationDeserializer.kt:286)
	at org.jetbrains.kotlin.backend.common.serialization.IrDeclarationDeserializer.deserializeValueParameters(IrDeclarationDeserializer.kt:376)
	at org.jetbrains.kotlin.backend.common.serialization.IrDeclarationDeserializer.access$deserializeValueParameters(IrDeclarationDeserializer.kt:56)
e: Compilation failed: IrErrorExpression(-2, -2, "Default Argument Value stub for page|2") found but error code is not allowed

	at org.jetbrains.kotlin.backend.common.serialization.IrDeclarationDeserializer$withDeserializedIrFunctionBase$1$1$1$1.invoke(IrDeclarationDeserializer.kt:481)
	at org.jetbrains.kotlin.backend.common.serialization.IrDeclarationDeserializer$withDeserializedIrFunctionBase$1$1$1$1.invoke(IrDeclarationDeserializer.kt:480)
	at org.jetbrains.kotlin.backend.common.serialization.IrDeclarationDeserializer.withBodyGuard(IrDeclarationDeserializer.kt:416)
	at org.jetbrains.kotlin.backend.common.serialization.IrDeclarationDeserializer.access$withBodyGuard(IrDeclarationDeserializer.kt:56)
	at org.jetbrains.kotlin.backend.common.serialization.IrDeclarationDeserializer.deserializeIrFunction$ir_serialization_common(IrDeclarationDeserializer.kt:892)
	at org.jetbrains.kotlin.backend.common.serialization.IrDeclarationDeserializer.deserializeDeclaration(IrDeclarationDeserializer.kt:688)
	at org.jetbrains.kotlin.backend.common.serialization.IrDeclarationDeserializer.deserializeIrClass(IrDeclarationDeserializer.kt:318)
	at org.jetbrains.kotlin.backend.common.serialization.IrDeclarationDeserializer.deserializeDeclaration(IrDeclarationDeserializer.kt:687)
	at org.jetbrains.kotlin.backend.common.serialization.IrFileDeserializer.deserializeDeclaration$ir_serialization_common(IrFileDeserializer.kt:36)
	at org.jetbrains.kotlin.backend.common.serialization.FileDeserializationState.deserializeAllFileReachableTopLevel(IrFileDeserializer.kt:127)
	at org.jetbrains.kotlin.backend.common.serialization.ModuleDeserializationState.deserializeReachableDeclarations(BasicIrModuleDeserializer.kt:163)
	at org.jetbrains.kotlin.backend.common.serialization.KotlinIrLinker.deserializeAllReachableTopLevels(KotlinIrLinker.kt:105)
	at org.jetbrains.kotlin.backend.common.serialization.KotlinIrLinker.findDeserializedDeclarationForSymbol(KotlinIrLinker.kt:124)
	at org.jetbrains.kotlin.backend.common.serialization.KotlinIrLinker.getDeclaration(KotlinIrLinker.kt:162)
	at org.jetbrains.kotlin.ir.util.ExternalDependenciesGeneratorKt.getDeclaration(ExternalDependenciesGenerator.kt:61)
	at org.jetbrains.kotlin.ir.util.ExternalDependenciesGenerator.generateUnboundSymbolsAsDependencies(ExternalDependenciesGenerator.kt:48)
	at org.jetbrains.kotlin.psi2ir.generators.ModuleGenerator.generateUnboundSymbolsAsDependencies(ModuleGenerator.kt:69)
	at org.jetbrains.kotlin.psi2ir.Psi2IrTranslator.generateModuleFragment(Psi2IrTranslator.kt:84)
	at org.jetbrains.kotlin.backend.konan.PsiToIrKt.psiToIr(PsiToIr.kt:163)
	at org.jetbrains.kotlin.backend.konan.ToplevelPhasesKt$psiToIrPhase$1.invoke(ToplevelPhases.kt:115)
	at org.jetbrains.kotlin.backend.konan.ToplevelPhasesKt$psiToIrPhase$1.invoke(ToplevelPhases.kt:114)
	at org.jetbrains.kotlin.backend.common.phaser.PhaseBuildersKt$namedOpUnitPhase$1.invoke(PhaseBuilders.kt:96)
	at org.jetbrains.kotlin.backend.common.phaser.PhaseBuildersKt$namedOpUnitPhase$1.invoke(PhaseBuilders.kt:94)
	at org.jetbrains.kotlin.backend.common.phaser.NamedCompilerPhase.invoke(CompilerPhase.kt:96)
	at org.jetbrains.kotlin.backend.common.phaser.CompositePhase.invoke(PhaseBuilders.kt:29)
	at org.jetbrains.kotlin.backend.common.phaser.NamedCompilerPhase.invoke(CompilerPhase.kt:96)
	at org.jetbrains.kotlin.backend.common.phaser.CompilerPhaseKt.invokeToplevel(CompilerPhase.kt:43)
	at org.jetbrains.kotlin.backend.konan.KonanDriverKt.runTopLevelPhases(KonanDriver.kt:34)
	at org.jetbrains.kotlin.cli.bc.K2Native.doExecute(K2Native.kt:78)
	at org.jetbrains.kotlin.cli.bc.K2Native.doExecute(K2Native.kt:35)
	at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:90)
	at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:44)
	at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:98)
	at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:76)
	at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:45)
	at org.jetbrains.kotlin.cli.common.CLITool$Companion.doMainNoExit(CLITool.kt:227)
	at org.jetbrains.kotlin.cli.bc.K2Native$Companion$mainNoExitWithGradleRenderer$1.invoke(K2Native.kt:298)
	at org.jetbrains.kotlin.cli.bc.K2Native$Companion$mainNoExitWithGradleRenderer$1.invoke(K2Native.kt:297)
	at org.jetbrains.kotlin.util.UtilKt.profileIf(Util.kt:22)
	at org.jetbrains.kotlin.util.UtilKt.profile(Util.kt:16)
	at org.jetbrains.kotlin.cli.bc.K2Native$Companion.mainNoExitWithGradleRenderer(K2Native.kt:297)
	at org.jetbrains.kotlin.cli.bc.K2NativeKt.mainNoExitWithGradleRenderer(K2Native.kt:497)
	at org.jetbrains.kotlin.cli.utilities.MainKt$daemonMain$1.invoke(main.kt:62)
	at org.jetbrains.kotlin.cli.utilities.MainKt$daemonMain$1.invoke(main.kt:62)
	at org.jetbrains.kotlin.cli.utilities.MainKt.mainImpl(main.kt:17)
	at org.jetbrains.kotlin.cli.utilities.MainKt.daemonMain(main.kt:62)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.jetbrains.kotlin.compilerRunner.KotlinToolRunner.runInProcess(KotlinToolRunner.kt:128)
	at org.jetbrains.kotlin.compilerRunner.KotlinToolRunner.run(KotlinToolRunner.kt:77)
	at org.jetbrains.kotlin.gradle.tasks.AbstractKotlinNativeCompile.compile(KotlinNativeTasks.kt:338)
	at org.jetbrains.kotlin.gradle.tasks.KotlinNativeLink.compile(KotlinNativeTasks.kt:663)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:104)
	at org.gradle.api.internal.project.taskfactory.StandardTaskAction.doExecute(StandardTaskAction.java:49)
	at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:42)
	at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:28)
	at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:726)
	at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:693)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$3.run(ExecuteActionsTaskExecuter.java:569)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:395)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:387)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:157)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:242)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:150)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:84)
	at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:554)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:537)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.access$300(ExecuteActionsTaskExecuter.java:108)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$TaskExecution.executeWithPreviousOutputFiles(ExecuteActionsTaskExecuter.java:278)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$TaskExecution.execute(ExecuteActionsTaskExecuter.java:267)
	at org.gradle.internal.execution.steps.ExecuteStep.lambda$execute$1(ExecuteStep.java:33)
	at java.base/java.util.Optional.orElseGet(Optional.java:369)
	at org.gradle.internal.execution.steps.ExecuteStep.execute(ExecuteStep.java:33)
	at org.gradle.internal.execution.steps.ExecuteStep.execute(ExecuteStep.java:26)
	at org.gradle.internal.execution.steps.CleanupOutputsStep.execute(CleanupOutputsStep.java:67)
	at org.gradle.internal.execution.steps.CleanupOutputsStep.execute(CleanupOutputsStep.java:36)
	at org.gradle.internal.execution.steps.ResolveInputChangesStep.execute(ResolveInputChangesStep.java:49)
	at org.gradle.internal.execution.steps.ResolveInputChangesStep.execute(ResolveInputChangesStep.java:34)
	at org.gradle.internal.execution.steps.CancelExecutionStep.execute(CancelExecutionStep.java:43)
	at org.gradle.internal.execution.steps.TimeoutStep.executeWithoutTimeout(TimeoutStep.java:73)
	at org.gradle.internal.execution.steps.TimeoutStep.execute(TimeoutStep.java:54)
	at org.gradle.internal.execution.steps.CatchExceptionStep.execute(CatchExceptionStep.java:34)
	at org.gradle.internal.execution.steps.CreateOutputsStep.execute(CreateOutputsStep.java:44)
	at org.gradle.internal.execution.steps.SnapshotOutputsStep.execute(SnapshotOutputsStep.java:54)
	at org.gradle.internal.execution.steps.SnapshotOutputsStep.execute(SnapshotOutputsStep.java:38)
	at org.gradle.internal.execution.steps.BroadcastChangingOutputsStep.execute(BroadcastChangingOutputsStep.java:49)
	at org.gradle.internal.execution.steps.CacheStep.executeWithoutCache(CacheStep.java:159)
	at org.gradle.internal.execution.steps.CacheStep.execute(CacheStep.java:72)
	at org.gradle.internal.execution.steps.CacheStep.execute(CacheStep.java:43)
	at org.gradle.internal.execution.steps.StoreExecutionStateStep.execute(StoreExecutionStateStep.java:44)
	at org.gradle.internal.execution.steps.StoreExecutionStateStep.execute(StoreExecutionStateStep.java:33)
	at org.gradle.internal.execution.steps.RecordOutputsStep.execute(RecordOutputsStep.java:38)
	at org.gradle.internal.execution.steps.RecordOutputsStep.execute(RecordOutputsStep.java:24)
	at org.gradle.internal.execution.steps.SkipUpToDateStep.executeBecause(SkipUpToDateStep.java:92)
	at org.gradle.internal.execution.steps.SkipUpToDateStep.lambda$execute$0(SkipUpToDateStep.java:85)
	at java.base/java.util.Optional.map(Optional.java:265)
	at org.gradle.internal.execution.steps.SkipUpToDateStep.execute(SkipUpToDateStep.java:55)
	at org.gradle.internal.execution.steps.SkipUpToDateStep.execute(SkipUpToDateStep.java:39)
	at org.gradle.internal.execution.steps.ResolveChangesStep.execute(ResolveChangesStep.java:76)
	at org.gradle.internal.execution.steps.ResolveChangesStep.execute(ResolveChangesStep.java:37)
	at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsFinishedStep.execute(MarkSnapshottingInputsFinishedStep.java:36)
	at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsFinishedStep.execute(MarkSnapshottingInputsFinishedStep.java:26)
	at org.gradle.internal.execution.steps.ResolveCachingStateStep.execute(ResolveCachingStateStep.java:94)
	at org.gradle.internal.execution.steps.ResolveCachingStateStep.execute(ResolveCachingStateStep.java:49)
	at org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.execute(CaptureStateBeforeExecutionStep.java:79)
	at org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.execute(CaptureStateBeforeExecutionStep.java:53)
	at org.gradle.internal.execution.steps.ValidateStep.execute(ValidateStep.java:74)
	at org.gradle.internal.execution.steps.SkipEmptyWorkStep.lambda$execute$2(SkipEmptyWorkStep.java:78)
	at java.base/java.util.Optional.orElseGet(Optional.java:369)
	at org.gradle.internal.execution.steps.SkipEmptyWorkStep.execute(SkipEmptyWorkStep.java:78)
	at org.gradle.internal.execution.steps.SkipEmptyWorkStep.execute(SkipEmptyWorkStep.java:34)
	at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsStartedStep.execute(MarkSnapshottingInputsStartedStep.java:39)
	at org.gradle.internal.execution.steps.LoadExecutionStateStep.execute(LoadExecutionStateStep.java:40)
	at org.gradle.internal.execution.steps.LoadExecutionStateStep.execute(LoadExecutionStateStep.java:28)
	at org.gradle.internal.execution.impl.DefaultWorkExecutor.execute(DefaultWorkExecutor.java:33)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeIfValid(ExecuteActionsTaskExecuter.java:194)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:186)
	at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:114)
	at org.gradle.api.internal.tasks.execution.FinalizePropertiesTaskExecuter.execute(FinalizePropertiesTaskExecuter.java:46)
	at org.gradle.api.internal.tasks.execution.ResolveTaskExecutionModeExecuter.execute(ResolveTaskExecutionModeExecuter.java:62)
	at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:57)
	at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:56)
	at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:36)
	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.executeTask(EventFiringTaskExecuter.java:77)
	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:55)
	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:52)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:409)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:399)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:157)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:242)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:150)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:94)
	at org.gradle.internal.operations.DelegatingBuildOperationExecutor.call(DelegatingBuildOperationExecutor.java:36)
	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:52)
	at org.gradle.execution.plan.LocalTaskNodeExecutor.execute(LocalTaskNodeExecutor.java:41)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:356)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:343)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:336)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:322)
	at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.lambda$run$0(DefaultPlanExecutor.java:127)
	at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.execute(DefaultPlanExecutor.java:191)
	at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.executeNextNode(DefaultPlanExecutor.java:182)
	at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.run(DefaultPlanExecutor.java:124)
	at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
	at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
e: java.lang.IllegalArgumentException: IrErrorExpression(-2, -2, "Default Argument Value stub for page|2") found but error code is not allowed

	at java.base/java.lang.Thread.run(Thread.java:834)


Execution failed for task ':shared:linkDebugFrameworkIosX64'.
> Compilation finished with errors```

FreezingException when using Main dispatcher

๐Ÿ‘‹

I'm running in to a FreezingException when integrating NativeCoroutines with Apollo3 which requires queries to be launched from Main dispatcher.

I couldn't reproduce it without apollo3 so I forked https://github.com/joreilly/MortyComposeKMM which is using Apollo3.

This is my branch with the crash: https://github.com/ychescale9/MortyComposeKMM/tree/reproduce-crash-with-NativeCoroutines-integration

This is the diff: ychescale9/MortyComposeKMM@dd65771#diff-c16bdea5c96b86a9098c45a11157d0a6f14338e025e52ca682b7753ccea205b2

Crash:

Uncaught Kotlin exception: kotlin.Throwable: The process was terminated due to the unhandled exception thrown in the coroutine [StandaloneCoroutine{Cancelling}@1160cc8, MainDispatcher]: freezing of CancellableContinuation(Shareable[kotlin.native.concurrent.WorkerBoundReference@11ebd88]){Active}@a1c408 has failed, first blocker is CancellableContinuation(Shareable[kotlin.native.concurrent.WorkerBoundReference@11ebd88]){Active}@a1c408
2021-09-12 19:34:36.176816+1000 iosApp[38612:22096996] [] nw_protocol_get_quic_image_block_invoke dlopen libquic failed
    at 0   shared                              0x000000010e32c5e2 kfun:kotlinx.coroutines#handleCoroutineExceptionImpl(kotlin.coroutines.CoroutineContext;kotlin.Throwable){} + 850 (/opt/buildAgent/work/44ec6e850d5c63f0/kotlinx-coroutines-core/native/src/CoroutineExceptionHandlerImpl.kt:15:21)
    at 1   shared                              0x000000010e2879e7 kfun:kotlinx.coroutines#handleCoroutineException(kotlin.coroutines.CoroutineContext;kotlin.Throwable){} + 807 (/opt/buildAgent/work/44ec6e850d5c63f0/kotlinx-coroutines-core/common/src/CoroutineExceptionHandler.kt:33:5)
    at 2   shared                              0x000000010e2774bf kfun:kotlinx.coroutines.StandaloneCoroutine.handleJobException#internal + 207 (/opt/buildAgent/work/44ec6e850d5c63f0/kotlinx-coroutines-core/common/src/Builders.common.kt:241:9)
    at 3   shared                              0x000000010e29491d kfun:kotlinx.coroutines.JobSupport.finalizeFinishingState#internal + 2381 (/opt/buildAgent/work/44ec6e850d5c63f0/kotlinx-coroutines-core/common/src/JobSupport.kt:230:59)
    at 4   shared                              0x000000010e2a07e4 kfun:kotlinx.coroutines.JobSupport.tryMakeCompletingSlowPath#internal + 1972 (/opt/buildAgent/work/44ec6e850d5c63f0/kotlinx-coroutines-core/common/src/JobSupport.kt:925:16)
    at 5   shared                              0x000000010e29ff02 kfun:kotlinx.coroutines.JobSupport.tryMakeCompleting#internal + 738 (/opt/buildAgent/work/44ec6e850d5c63f0/kotlinx-coroutines-core/common/src/JobSupport.kt:878:16)
    at 6   shared                              0x000000010e29f9b0 kfun:kotlinx.coroutines.JobSupport#makeCompletingOnce(kotlin.Any?){}kotlin.Any? + 544 (/opt/buildAgent/work/44ec6e850d5c63f0/kotlinx-coroutines-core/common/src/JobSupport.kt:843:30)
    at 7   shared                              0x000000010e276043 kfun:kotlinx.coroutines.AbstractCoroutine#resumeWith(kotlin.Result<1:0>){} + 323 (/opt/buildAgent/work/44ec6e850d5c63f0/kotlinx-coroutines-core/common/src/AbstractCoroutine.kt:104:21)
    at 8   shared                              0x000000010dfeaca3 kfun:kotlin.coroutines.native.internal.BaseContinuationImpl#resumeWith(kotlin.Result<kotlin.Any?>){} + 1555 (/Users/teamcity1/teamcity_work/7c4fade2802b7783/kotlin/kotlin-native/runtime/src/main/kotlin/kotlin/coroutines/ContinuationImpl.kt:43:32)
    at 9   shared                              0x000000010e339013 kfun:kotlinx.coroutines.internal.ShareableContinuation#resumeWith(kotlin.Result<1:0>){} + 595 (/opt/buildAgent/work/44ec6e850d5c63f0/kotlinx-coroutines-core/native/src/internal/Sharing.kt:185:22)
    at 10  shared                              0x000000010e317abe kfun:kotlinx.coroutines.internal.ScopeCoroutine#afterResume(kotlin.Any?){} + 366 (/opt/buildAgent/work/44ec6e850d5c63f0/kotlinx-coroutines-core/common/src/internal/Scopes.kt:43:15)
    at 11  shared                              0x000000010e2760c4 kfun:kotlinx.coroutines.AbstractCoroutine#resumeWith(kotlin.Result<1:0>){} + 452 (/opt/buildAgent/work/44ec6e850d5c63f0/kotlinx-coroutines-core/common/src/AbstractCoroutine.kt:106:9)
    at 12  shared                              0x000000010dfeaca3 kfun:kotlin.coroutines.native.internal.BaseContinuationImpl#resumeWith(kotlin.Result<kotlin.Any?>){} + 1555 (/Users/teamcity1/teamcity_work/7c4fade2802b7783/kotlin/kotlin-native/runtime/src/main/kotlin/kotlin/coroutines/ContinuationImpl.kt:43:32)
    at 13  shared                              0x000000010e30f0d8 kfun:kotlinx.coroutines.DispatchedTask#run(){} + 2616 (/opt/buildAgent/work/44ec6e850d5c63f0/kotlinx-coroutines-core/common/src/internal/DispatchedTask.kt:103:25)
    at 14  shared                              0x000000010e33bb4a kfun:kotlinx.coroutines.DarwinMainDispatcher.dispatch$lambda-0#internal + 90 (/opt/buildAgent/work/44ec6e850d5c63f0/kotlinx-coroutines-core/nativeDarwin/src/Dispatchers.kt:35:19)
    at 15  shared                              0x000000010e33be60 kfun:kotlinx.coroutines.DarwinMainDispatcher.$dispatch$lambda-0$FUNCTION_REFERENCE$43.invoke#internal + 64 (/opt/buildAgent/work/44ec6e850d5c63f0/kotlinx-coroutines-core/nativeDarwin/src/Dispatchers.kt:34:51)
    at 16  shared                              0x000000010e33bf70 kfun:kotlinx.coroutines.DarwinMainDispatcher.$dispatch$lambda-0$FUNCTION_REFERENCE$43.$<bridge-UNN>invoke(){}#internal + 64 (/opt/buildAgent/work/44ec6e850d5c63f0/kotlinx-coroutines-core/nativeDarwin/src/Dispatchers.kt:34:51)
    at 17  shared                              0x000000010e33d099 _6f72672e6a6574627261696e732e6b6f746c696e783a6b6f746c696e782d636f726f7574696e65732d636f7265_knbridge8 + 185 (/opt/buildAgent/work/44ec6e850d5c63f0/kotlinx-coroutines-core/nativeDarwin/src/Dispatchers.kt:34:51)
    at 18  libdispatch.dylib                   0x000000010e9e3578 _dispatch_call_block_and_release + 12
    at 19  libdispatch.dylib                   0x000000010e9e474e _dispatch_client_callout + 8
    at 20  libdispatch.dylib                   0x000000010e9f2b3f _dispatch_main_queue_callback_4CF + 1152
    at 21  CoreFoundation                      0x00007fff203908f8 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
    at 22  CoreFoundation                      0x00007fff2038b169 __CFRunLoopRun + 2781
    at 23  CoreFoundation                      0x00007fff2038a1a7 CFRunLoopRunSpecific + 567
    at 24  GraphicsServices                    0x00007fff2b874d85 GSEventRunModal + 139
    at 25  UIKitCore                           0x00007fff246c14df -[UIApplication _run] + 912
    at 26  UIKitCore                           0x00007fff246c639c UIApplicationMain + 101
    at 27  iosApp                              0x000000010d925ddb main + 75 (/Users/.../MortyComposeKMM/iosApp/iosApp/AppDelegate.swift:<unknown>)
    at 28  libdyld.dylib                       0x00007fff2025abbd start + 1

This original repo is using this (which uses this dispatcher implementation) which seems to work.

Native methods on interfaces or interface delegation?

Hello, our Kotlin Multiplatform project is modularized, where one feature has at lest 2 gradle modules: an API module that contains the interfaces and data structures, and an Implementation module that contains the implementation details for the API module.

Currently we are using Kotlin / Native wrappers akin to this:

class FlowWrapper<T>(
    private val scope: CoroutineScope,
    private val flow: Flow<T>,
) {
    init {
        freeze()
    }

    fun subscribe(
        onEach: (item: T) -> Unit,
        onThrow: (error: Throwable) -> Unit,
    ): Job = subscribe(onEach, onThrow, {})

    fun subscribe(
        onEach: (item: T) -> Unit,
        onThrow: (error: Throwable) -> Unit,
        onComplete: () -> Unit,
    ): Job = flow
        .onEach { onEach(it.freeze()) }
        .catch { onThrow(it.freeze()) }
        .onCompletion { onComplete() }
        .launchIn(scope)
        .freeze()
}

link

class GetTodoCountIos(
    private val getTodoCount: GetTodoCount
){

    fun invoke(): FlowWrapper<TodoCount> =
        FlowWrapper(
            scope = CoroutineScope(SupervisorJob() + Dispatchers.Main),
            flow = getTodoCount()
        )
}

Where GetTodoCount is an interface, and in swift this wrapper is used as getTodoCount:
link

getTodoCount.invoke().subscribe { count in
    if (count != nil){
        self.count = count as! TodoCount
    }
} onThrow: { KotlinThrowable in
    
}

Removing the wrapper

When trying this library out I was unable to use the interface abstraction on iOS. I removed the GetTodoCountIos wrapper and tried to use the interface directly:
link

let future = createPublisher(for: getTodoCount.invokeNative())

let cancellable = future.sink { completion in
    print("Received completion: \(completion)")
} receiveValue: { count in
    print("Received value: \(count)")
    if (count != nil){
        self.count = count as! TodoCount
    }
}

But it fails with the following error:

2022-02-04 08:31:38.374976+0100 KaMPKitiOS[1700:34628] -[Shared_kobjcc0 invokeNative]: unrecognized selector sent to instance 0x60000194d290
2022-02-04 08:31:38.419835+0100 KaMPKitiOS[1700:34628] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[Shared_kobjcc0 invokeNative]: unrecognized selector sent to instance 0x60000194d290'

It does generate the correct native function, but the function crashes the app:

__attribute__((swift_name("GetTodoCount")))
@protocol SharedGetTodoCount
@required
- (id<SharedFlow>)invoke __attribute__((swift_name("invoke()")));
- (SharedKotlinUnit *(^(^)(SharedKotlinUnit *(^)(SharedTodoCount *, SharedKotlinUnit *), SharedKotlinUnit *(^)(NSError * _Nullable, SharedKotlinUnit *)))(void))invokeNative __attribute__((swift_name("invokeNative()")));
@end;

I'm not sure if this is caused by the fact that the interface does not know what the underlying implementation is or it is related to something else.

Light weight wrapper by interface delegation

Another solution I tried was using interface delegation, the wrapper is still written by hand but it's pretty concise and does not require updates when changing the interface:
link

class GetTodoCountIos(
    private val getTodoCount: GetTodoCount
) : GetTodoCount by getTodoCount

link
But it also fails, but with a different error:

Terminating app due to uncaught exception 'NSGenericException', reason: '[SharedGetTodoCountIos invokeNative] can't be overridden: it is final'

The generated header file:

__attribute__((objc_subclassing_restricted))
__attribute__((swift_name("GetTodoCountIos")))
@interface SharedGetTodoCountIos : SharedBase <SharedGetTodoCount>
- (instancetype)initWithGetTodoCount:(id<SharedGetTodoCount>)getTodoCount __attribute__((swift_name("init(getTodoCount:)"))) __attribute__((objc_designated_initializer));
- (id<SharedFlow>)invoke __attribute__((swift_name("invoke()")));
@end;

Maybe it would be possible to extend it using an extension function?

Normal wrapper

The only solution that did not crash was creating the wrapper and calling the methods on the interface:
link

class GetTodoCountIos(
    private val getTodoCount: GetTodoCount
){

    fun invoke(): Flow<TodoCount> = getTodoCount()
}

With the following header:

__attribute__((objc_subclassing_restricted))
__attribute__((swift_name("GetTodoCountIos")))
@interface SharedGetTodoCountIos : SharedBase
- (instancetype)initWithGetTodoCount:(id<SharedGetTodoCount>)getTodoCount __attribute__((swift_name("init(getTodoCount:)"))) __attribute__((objc_designated_initializer));
- (id<SharedFlow>)invoke __attribute__((swift_name("invoke()")));
- (SharedKotlinUnit *(^(^)(SharedKotlinUnit *(^)(SharedTodoCount *, SharedKotlinUnit *), SharedKotlinUnit *(^)(NSError * _Nullable, SharedKotlinUnit *)))(void))invokeNative __attribute__((swift_name("invokeNative()")));
@end;

However this also didn't work as expected, because the flow is never collected (onEach, onComplete never called).

The repository to reproduce this is available here:

Functions with a constrained generic value parameter fail to build

From #8 (comment).

Functions with a generic constrained value parameter:

suspend fun <T: Appendable> sendGenericValue(value: T): Unit = TODO()

fail to build with the following exception:

java.util.NoSuchElementException: Sequence contains no element matching the predicate.
    at com.rickclephas.kmp.nativecoroutines.compiler.KmpNativeCoroutinesIrTransformer.visitFunctionNew(KmpNativeCoroutinesIrTransformer.kt:227)
    at org.jetbrains.kotlin.backend.common.IrElementTransformerVoidWithContext.visitFunction(IrElementTransformerVoidWithContext.kt:68)
    at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitSimpleFunction(IrElementTransformerVoid.kt:72)
    ...

It seems that In the generated native version the value parameter isn't recognised as T: Appendable but as T: Any?.

Swift frameworks fail to build with Carthage

When trying to build the Swift frameworks with Carthage (instead of SPM or Cocoapods), it fails because the iOS deployment target is incorrect in the KMPNativeCoroutinesAsync project.

Add support for flows in interfaces

I would like to share interfaces of my ViewModels to iOS instead of the actual implementation, but the native properties are not generated for the flows in my interface. Is there something that needs to be setup for this to work?
And if not, could this be added?

Add "support" for all Kotlin targets

When adding the gradle plugin it to my kotlin multiplatform module and syncing with IDE, all of the source sets except the android ones get removed from the IDE.

I get this message:
image

Also, in the project view only the android source sets are configured correctly. I then get no code intelligence when editing files in any of the other source sets.
image

As soon as I remove the plugin and sync again, all of the source sets get added back to the IDE:
image

Any ideas what could be causing this or how to diagnose it further? The plugin seems quite simple so I'm not sure why this would happen. I tried disabling all other third party plugins in the module (just keeping kotlin and android plugins) and I still have the same issue.

Add JS support

JS and native share some limitations with the coroutines interop.
The generic way of exposing callbacks could be applied to JS as well.
Allowing the clients to decide on an appropriate "native coroutines implementation".

Compatibility issue with KSP

> Task :shared:kspKotlinIosSimulatorArm64 FAILED
e: Required plugin option not present: com.rickclephas.kmp.nativecoroutines:suffix

Plugin "com.rickclephas.kmp.nativecoroutines" usage:
  suffix string              suffix used for the generated functions (required)

but I also have

nativeCoroutines {
    suffix = "ios"
}

inside shared.build.gradle.kts

it shows same Xcode error with and without it

pod install error

Getting following errors when I open project (in AS Arctic Fox).

Executing of 'pod install' failed with code 1.
Error message:
[!] No `Podfile' found in the project directory.

Please, check that file "/Users/joreilly/dev/github/KMP-NativeCoroutines/Podfile" contains following lines in header:
source 'https://cdn.cocoapods.org'

Please, check that each target depended on NativeCoroutinesSampleShared contains following dependencies:

Transform createdPublisher into SwiftUI's @Published

I am wondering if and how I could transform a AnyPublisher to a @Published property. Let's say I have a property in my swift view model like @Published var isNetworkConnected: Bool which is defined as val isNetworkConnected: MutableStateFlow<Boolean> in my shared code repository. I now would like to do something like:

self.isNetworkConnected = createPublisher(for: self.repository.isNetworkConnectedNative)

Or even better, I would like to do something like this:

Text(appViewModel.repository.connectivityStatus.isNetworkConnectedNative)

Of course the variable should update automatically and take care of cancelling the publisher when the view is deleted by the SwiftUI framework. Is that somehow possible or could be achieved in the future? It would be a massive simplification when using KMM with SwiftUI as the biolerplate code in the view model would not be needed.

Non-embeddable compiler JAR compilations are broken in v1.0

Projects with the following gradle property

kotlin.native.useEmbeddableCompilerJar=false

fail to build in the kspKotlin tasks with

e: java.lang.IllegalStateException: The provided plugin com.google.devtools.ksp.KotlinSymbolProcessingComponentRegistrar is not compatible with this version of compiler
	at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment$Companion.registerExtensionsFromPlugins$cli(KotlinCoreEnvironment.kt:664)
	...
Caused by: java.lang.AbstractMethodError: Receiver class com.google.devtools.ksp.KotlinSymbolProcessingComponentRegistrar does not define or inherit an implementation of the resolved method 'abstract void registerProjectComponents(com.intellij.mock.MockProject, org.jetbrains.kotlin.config.CompilerConfiguration)' of interface org.jetbrains.kotlin.compiler.plugin.ComponentRegistrar.
	at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment$Companion.registerExtensionsFromPlugins$cli(KotlinCoreEnvironment.kt:656)

Caused by google/ksp#1155

Migrate compiler plugin to KSP

When the current compiler plugin was created KSP didn't support Kotlin/Native and a custom compiler plugin would allow us to modify classes instead of creating extension functions (which seemed a great idea at the time).
However the current compiler plugin has some issues:

  • It can cause recursion errors since it uses non-public APIs to get the required information
  • It's currently incompatible with KSP
  • Modifying the classes can cause some issues with inheritance and interface usages from Swift
  • The compiler plugin is tied to a specific Kotlin version, so it requires a lot of maintenance

Using KSP would solve all these issues. The only downside being that we can no longer modify the classes and would need to generate extension properties/functions, which might not be exposed to ObjC/Swift in the same way.

Implicit return types combined with some annotations can cause recursion errors

๐Ÿ‘‹
I facing with iOs building issue after integrating the KMP-Native coroutines library.
Library version 0.8.0, kotlin 1.5.31

Build stacktrace:stacktrace.txt
NetworkProvider.kt:

class NetworkProvider(val storage: SharedStorage) {
    val serverMode: ServerMode
        get() = getServerModeById(storage.serverMode)

    val client = HttpClient {
        expectSuccess = false

        install(Logging) {
            logger = object : Logger {
                override fun log(message: String) {
                }
            }
            level = LogLevel.ALL
        }
        install(JsonFeature) {
            serializer = KotlinxSerializer(json = kotlinx.serialization.json.Json {
                isLenient = false
                ignoreUnknownKeys = true
                allowSpecialFloatingPointValues = true
                useArrayPolymorphism = false
            })
        }
        HttpResponseValidator {
            handleResponseException { cause ->
                throw cause
            }
            validateResponse { response ->
                val statusCode = response.status.value
                val originCall = response.call
                if (statusCode < 300 || originCall.attributes.contains(ValidateMark)) {
                    return@validateResponse
                }

                val exceptionCall = originCall.save().apply {
                    attributes.put(ValidateMark, Unit)
                }

                val exceptionResponse = exceptionCall.response
                val exceptionResponseText = exceptionResponse.readText()

                when (statusCode) {
                    in 300..399 -> throw RedirectNetworkException(
                        exceptionResponse,
                        exceptionResponseText,
                        statusCode
                    )
                    in 400..499 -> throw ClientNetworkException(
                        exceptionResponse,
                        exceptionResponseText,
                        statusCode
                    )
                    in 500..599 -> throw ServerNetworkException(
                        exceptionResponse,
                        exceptionResponseText,
                        statusCode
                    )
                    else -> throw NetworkException(
                        exceptionResponse,
                        exceptionResponseText,
                        statusCode
                    )
                }
            }
        }
    }

    fun HttpRequestBuilder.applyAppHeaders(): HeadersBuilder {
        return headers.apply {
            append(ApiConstantsShared.Api.CONSUMER_KEY_FIELD, serverMode.consumerKey)
            if ([email protected]()) {
                append(ApiConstantsShared.Api.ACCESS_KEY_FIELD, storage.sessionKey)
                append(
                    ApiConstantsShared.Api.COOKIE,
                    "${ApiConstantsShared.Api.SESSION_ID}=${storage.sessionKey}"
                )
            }
        }
    }

    suspend inline fun <reified ResponseData> delete(
        path: String,
        parameters: List<Pair<String, String>> = emptyList()
    ): Response<ResponseData> {
        return try {
            Logger.DEFAULT.log(this.toString())
            val url = serverMode.baseUrl + "/" + path

            Logger.DEFAULT.log("Path: $url")
            Logger.DEFAULT.log("Parameters: $parameters")

            val response = client.delete<ResponseData>(url) {
                parameters.forEach {
                    this.parameter(it.first, it.second)
                }
                headers { applyAppHeaders() }
            }
            Logger.DEFAULT.log("Response: $response")
            Response.Success(response)
        } catch (ex: Exception) {
            ex.message?.let { Logger.DEFAULT.log(it) }
            Response.Error(ex)
        }
    }

    suspend inline fun <reified ResponseData> getItem(
        path: String,
        parameters: List<Pair<String, String>> = emptyList()
    ): Response<ResponseData> {
        return try {
            Logger.DEFAULT.log(this.toString())
            val url = serverMode.baseUrl + "/" + path

            Logger.DEFAULT.log("Path: $url")
            Logger.DEFAULT.log("Parameters: $parameters")

            val response = client.get<ResponseData>(url) {
                parameters.forEach {
                    this.parameter(it.first, it.second)
                }
                headers { applyAppHeaders() }
            }
            Logger.DEFAULT.log("Response: $response")
            Response.Success(response)
        } catch (ex: Exception) {
            ex.message?.let { Logger.DEFAULT.log(it) }
            Response.Error(ex)
        }
    }

    suspend inline fun <reified ResponseData, Body> postItem(
        path: String,
        parameters: List<Pair<String, String>> = emptyList(),
        body: Body? = null
    ): Response<ResponseData> {
        return try {
            Logger.DEFAULT.log(this.toString())
            val url = serverMode.baseUrl + "/" + path

            Logger.DEFAULT.log("Path: $url")
            Logger.DEFAULT.log("Parameters: $parameters")
            Logger.DEFAULT.log("Body: $body")

            val response = client.post<ResponseData>(url) {
                headers { applyAppHeaders() }
                if (parameters.isNotEmpty()) {
                    this.body = FormDataContent(
                        Parameters.build {
                            parameters.forEach {
                                this.append(it.first, it.second)
                            }
                        }
                    )
                } else if (body != null) {
                    header(HttpHeaders.ContentType, ContentType.Application.Json)
                    this.body = body
                }
            }
            Logger.DEFAULT.log("Response: $response")
            return Response.Success(response)
        } catch (ex: Exception) {
            ex.message?.let { Logger.DEFAULT.log(it) }
            Response.Error(ex)
        }
    }

    @OptIn(InternalAPI::class)
    suspend inline fun <reified ResponseData, reified Body> uploadFiles(
        path: String,
        filesData: Map<String, ByteArray>,
        filesJsonData: Body
    ): Response<ResponseData> {
        return try {
            Logger.DEFAULT.log(this.toString())
            val url = serverMode.baseUrl + "/" + path

            Logger.DEFAULT.log("Path: $url")
            Logger.DEFAULT.log("FilesData: $filesJsonData")

            val response = client.post<ResponseData>(url) {
                headers { applyAppHeaders() }
                body = MultiPartFormDataContent(
                    formData {
                        filesData.entries.map { entry ->
                            this.append(
                                key = entry.key,
                                value = entry.value,
                                headers = Headers.build {
                                    append(
                                        HttpHeaders.ContentDisposition,
                                        ApiConstantsShared.UploadImage.FILENAME +
                                                entry.key +
                                                ApiConstantsShared.UploadImage.IMAGE_EXT
                                    )
                                    append(
                                        HttpHeaders.ContentType,
                                        ApiConstantsShared.UploadImage.IMAGE_CONTENT_TYPE
                                    )
                                }
                            )
                        }
                        this.append(
                            key = ApiConstantsShared.UploadImage.PARAM_UPDATE,
                            value = filesJsonData.convertToJsonString(),
                            headers = Headers.build {
                                append(HttpHeaders.ContentType, ContentType.Application.Json)
                            }
                        )
                    }
                )
            }
            Logger.DEFAULT.log("Response: $response")
            Response.Success(response)
        } catch (ex: Exception) {
            ex.printStackTrace()
            ex.message?.let { Logger.DEFAULT.log(it) }
            Response.Error(ex)
        }
    }

    inline fun <reified DataResponse> performDeleteApiMethod(
        path: String,
        params: List<Pair<String, String>> = listOf()
    ): Flow<Response<DataResponse>> {
        return flow {
            val data = [email protected]<DataResponse>(path, params)
            emit(data)
        }
    }

    inline fun <reified DataResponse> performApiMethod(
        path: String,
        params: List<Pair<String, String>> = listOf()
    ): Flow<Response<DataResponse>> {
        return flow {
            val data = [email protected]<DataResponse>(path, params)
            emit(data)
        }
    }

    inline fun <reified DataResponse, Body> performApiMethod(
        path: String,
        params: List<Pair<String, String>> = listOf(),
        body: Body? = null
    ): Flow<Response<DataResponse>> {
        return flow {
            val data = [email protected]<DataResponse, Body>(path, params, body)
            emit(data)
        }
    }

    inline fun <reified DataResponse, reified Body> performApiMethod(
        path: String,
        filesData: Map<String, ByteArray>,
        filesJsonData: Body
    ): Flow<Response<DataResponse>> {
        return flow {
            val data = [email protected]<DataResponse, Body>(
                path,
                filesData,
                filesJsonData
            )
            emit(data)
        }
    }
}

Unresolved reference: asNativeFlow()

Hello!

First of all, thanks for the lib! I'm trying to integrate it in our sample project but I get this issue, it's so strange because the plugin is already in... but it doesn't compile.

Project is opensource https://github.com/worldline-spain/kmm_multimodule/blob/a7f93f3d6738fdba6053a02b9f77e98027d3dc54/shared/ui/logic/poilistvm/src/commonMain/kotlin/com/worldline/kmm/ui/logic/poilistvm/PoiListViewModel.kt#L22

Maybe there is something wrong on my side... :( but it just install the plugin and that's all, right?

Thanks! Sergio

EDIT: Ahhh I see the "issue" is in readme, Am I right?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.