Also ``` @ExperimentalUnsignedTypes fun main(args:...
# announcements
j
Also
Copy code
@ExperimentalUnsignedTypes
fun main(args: Array<String>) {
    var a: UByte = 0u
    println(--a) // -1
}
but
Copy code
@ExperimentalUnsignedTypes
fun main(args: Array<String>) {
    var a: UByte = 0u
    --a
    println(a)  // 255
}
😬 4
youtrack 4
p
Does
println()
accepts UByte?
println((--a).toString())
works fine 🙂
println(--a as UByte)
produces
java.lang.ClassCastException: java.lang.Byte cannot be cast to kotlin.UByte
i
That's why they are called
ExperimentalUnsignedTypes
, not everything is smooth, especially in the first preview.
j
Just bringing it to peoples attention, not meaning to be negative. I have been looking forward to unsigned types for a long time 🙂
i
I've checked, it hasn't been fixed yet in the development branch, so I've opened https://youtrack.jetbrains.com/issue/KT-26219
j
I had opened an issue as well, if you spot it could you close it? 🙂
Ah you already did