intellij-community icon indicating copy to clipboard operation
intellij-community copied to clipboard

KTIJ-20639 "Remove explicit type" breaks code for Long variables

Open t-kameyama opened this issue 3 years ago • 3 comments
trafficstars

https://youtrack.jetbrains.com/issue/KTIJ-20639

t-kameyama avatar Jan 28 '22 08:01 t-kameyama

I believe this issue is also true for other numeric types. For example:

val long: Long = 0 // 0 -> 0L
val uLong: ULong = 0u // 0u -> 0uL; 0U -> 0UL
val byte: Byte = 0 // 0 -> 0.toByte()
val short: Short = 0 // 0 -> 0.toShort()

Could you please support these cases as well?

zarechenskiy avatar Feb 07 '22 11:02 zarechenskiy

Also, while we're on this issue, please consider case when we have null on RHS:

val long: Long? = null

We could insert cast in this case:

val long = null as Long?

zarechenskiy avatar Feb 07 '22 11:02 zarechenskiy

Fixed

t-kameyama avatar Feb 09 '22 07:02 t-kameyama