Make unsigned types experimental (with warning if not opted-in)

This commit is contained in:
Ilya Gorbunov
2018-07-03 14:56:26 +03:00
parent 71292bd681
commit b5fabf3f72
15 changed files with 78 additions and 0 deletions
@@ -8,6 +8,7 @@
package kotlin
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
public inline class UByteArray
@Suppress("NON_PUBLIC_PRIMARY_CONSTRUCTOR_OF_INLINE_CLASS")
@PublishedApi
@@ -41,10 +42,12 @@ internal constructor(private val storage: ByteArray) : Collection<UByte> {
}
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
public inline fun UByteArray(size: Int, init: (Int) -> UByte): UByteArray {
return UByteArray(ByteArray(size) { index -> init(index).toByte() })
}
@SinceKotlin("1.3")
@ExperimentalUnsignedTypes
// TODO: @kotlin.internal.InlineOnly
public inline fun ubyteArrayOf(vararg elements: UByte): UByteArray = elements