Kotlin / KEEP

Kotlin Evolution and Enhancement Process
Apache License 2.0
3.29k stars 357 forks source link

Kotlin Usigned Operations #359

Closed Pseudow closed 9 months ago

Pseudow commented 10 months ago

Could we please add some kind of operations between Unsigned types like for example this:

val uShort1: UShort = 1u
val uShort2: UShort = 1u

val uShort3: UShort = uShort1 + uShort2
quickstep24 commented 9 months ago

The operations are there, but they implicitly cast to UInt. Operator plus is declared

@kotlin.internal.InlineOnly public final inline operator fun plus(other: kotlin.UShort): kotlin.UInt

So you have to write

val uShort3: UShort = (uShort1 + uShort2).toUShort()
r4zzz4k commented 9 months ago

Also, this repository is not meant for general feature requests. As stated in README, it describes design notes of language changes which are already being coordinated with Kotlin language designers. To share your feature requests or bug reports, please consider using YouTrack.

nikitabobko commented 9 months ago

@r4zzz4k is completely right here. Please use YouTrack for feature requests or bug reports