Long literals


#1

Is it planned to improve number literals? I need to do some binary arithmetic with longs and I’m unable to initialize a variable with, for example,

0xFF00FF00FF00FF00L

because “the value is out of range”. Also, you can’t write Long.MIN_VALUE as a literal in any way (even if you don’t use hex), because

println(-9223372036854775808)

also creates the “the value is out of range” error (even though it is a valid Long). I understand this is probably because this is interpreted as a positive number with a unary operator, but it’s really annoying and an unnecessary complication.


#2

Please watch https://youtrack.jetbrains.com/issue/KT-4749. We discussed this some time before release and didn’t come up with a clear understanding of how the current situation can be improved, but it’s likely that we’ll revisit this issue later.