diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/descriptors/DescriptorUtils.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/descriptors/DescriptorUtils.kt index 0eaa9ed4e6b..3bfaddd42d9 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/descriptors/DescriptorUtils.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/descriptors/DescriptorUtils.kt @@ -74,9 +74,14 @@ internal fun T.resolveFakeOverride(): T { private val intrinsicAnnotation = FqName("konan.internal.Intrinsic") -// TODO: check it is external? -internal val CallableDescriptor.isIntrinsic: Boolean - get() = this.annotations.findAnnotation(intrinsicAnnotation) != null +internal val FunctionDescriptor.isIntrinsic: Boolean + get() = when { + this.annotations.hasAnnotation(intrinsicAnnotation) -> { + check(isExternal, { "Intrinsic function $name should be external" }) + true + } + else -> false + } private val intrinsicTypes = setOf( "kotlin.Boolean", "kotlin.Char", diff --git a/runtime/src/main/kotlin/konan/internal/Coroutines.kt b/runtime/src/main/kotlin/konan/internal/Coroutines.kt index 1f9666a4cbe..ce8ea52f74a 100644 --- a/runtime/src/main/kotlin/konan/internal/Coroutines.kt +++ b/runtime/src/main/kotlin/konan/internal/Coroutines.kt @@ -21,11 +21,11 @@ import kotlin.coroutines.experimental.intrinsics.* @Intrinsic @PublishedApi -internal fun getContinuation(): Continuation = throw AssertionError("Call to getContinuation should've been lowered") +internal external fun getContinuation(): Continuation = throw AssertionError("Call to getContinuation should've been lowered") @Intrinsic @PublishedApi -internal suspend fun returnIfSuspended(@Suppress("UNUSED_PARAMETER") argument: Any?): T +internal external suspend fun returnIfSuspended(@Suppress("UNUSED_PARAMETER") argument: Any?): T = throw AssertionError("Call to returnIfSuspended should've been lowered") // Single-threaded continuation.