[K/N] Make assert functions experimental with ExperimentalNativeApi
This commit is contained in:
committed by
Space Team
parent
245ef256bd
commit
b6c2ce2dc8
@@ -5,11 +5,14 @@
|
||||
|
||||
package kotlin
|
||||
|
||||
import kotlin.experimental.ExperimentalNativeApi
|
||||
|
||||
/**
|
||||
* Throws an [AssertionError] if the [value] is false
|
||||
* and runtime assertions have been enabled during compilation.
|
||||
*/
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
@ExperimentalNativeApi
|
||||
public inline fun assert(value: Boolean) {
|
||||
assert(value) { "Assertion failed" }
|
||||
}
|
||||
@@ -18,6 +21,7 @@ public inline fun assert(value: Boolean) {
|
||||
* Throws an [AssertionError] calculated by [lazyMessage] if the [value] is false
|
||||
* and runtime assertions have been enabled during compilation.
|
||||
*/
|
||||
@ExperimentalNativeApi
|
||||
public inline fun assert(value: Boolean, lazyMessage: () -> Any) {
|
||||
if (!value) {
|
||||
val message = lazyMessage()
|
||||
|
||||
@@ -5,10 +5,11 @@
|
||||
|
||||
package kotlin.native.concurrent
|
||||
|
||||
import kotlin.experimental.ExperimentalNativeApi
|
||||
import kotlin.native.internal.*
|
||||
import kotlinx.cinterop.*
|
||||
|
||||
@OptIn(FreezingIsDeprecated::class)
|
||||
@OptIn(FreezingIsDeprecated::class, ExperimentalNativeApi::class)
|
||||
public class Continuation0(block: () -> Unit,
|
||||
private val invoker: CPointer<CFunction<(COpaquePointer?) -> Unit>>,
|
||||
private val singleShot: Boolean = false): Function0<Unit> {
|
||||
@@ -32,7 +33,7 @@ public class Continuation0(block: () -> Unit,
|
||||
}
|
||||
}
|
||||
|
||||
@OptIn(FreezingIsDeprecated::class)
|
||||
@OptIn(FreezingIsDeprecated::class, ExperimentalNativeApi::class)
|
||||
public class Continuation1<T1>(
|
||||
block: (p1: T1) -> Unit,
|
||||
private val invoker: CPointer<CFunction<(COpaquePointer?) -> Unit>>,
|
||||
@@ -64,7 +65,7 @@ public class Continuation1<T1>(
|
||||
}
|
||||
}
|
||||
|
||||
@OptIn(FreezingIsDeprecated::class)
|
||||
@OptIn(FreezingIsDeprecated::class, ExperimentalNativeApi::class)
|
||||
public class Continuation2<T1, T2>(
|
||||
block: (p1: T1, p2: T2) -> Unit,
|
||||
private val invoker: CPointer<CFunction<(COpaquePointer?) -> Unit>>,
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
package kotlin.native.concurrent
|
||||
|
||||
import kotlin.experimental.ExperimentalNativeApi
|
||||
import kotlin.native.internal.Frozen
|
||||
|
||||
@FreezingIsDeprecated
|
||||
@@ -84,6 +85,7 @@ internal object INITIALIZING {
|
||||
}
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalNativeApi::class)
|
||||
@FreezingIsDeprecated
|
||||
@Frozen
|
||||
internal class AtomicLazyImpl<out T>(initializer: () -> T) : Lazy<T> {
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
package kotlin.native.concurrent
|
||||
|
||||
import kotlin.experimental.ExperimentalNativeApi
|
||||
import kotlin.native.internal.Frozen
|
||||
|
||||
@ThreadLocal
|
||||
@@ -14,7 +15,7 @@ private object CurrentThread {
|
||||
}
|
||||
|
||||
@Frozen
|
||||
@OptIn(FreezingIsDeprecated::class)
|
||||
@OptIn(FreezingIsDeprecated::class, ExperimentalNativeApi::class)
|
||||
internal class Lock {
|
||||
private val locker_ = AtomicInt(0)
|
||||
private val reenterCount_ = AtomicInt(0)
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
package kotlin.native.concurrent
|
||||
|
||||
import kotlin.experimental.ExperimentalNativeApi
|
||||
import kotlin.native.internal.*
|
||||
import kotlinx.cinterop.*
|
||||
|
||||
@@ -42,6 +43,7 @@ public class MutableData constructor(capacity: Int = 16) {
|
||||
private val lock = Lock()
|
||||
|
||||
private fun resizeDataLocked(newSize: Int): Int {
|
||||
@OptIn(ExperimentalNativeApi::class)
|
||||
assert(newSize >= size)
|
||||
if (newSize > buffer.size) {
|
||||
val actualSize = maxOf(buffer.size * 3 / 2 + 1, newSize)
|
||||
|
||||
Reference in New Issue
Block a user