Hello,--
I'm curious why bitwise operators for certain numeric types work in such a strange way.
scala> :paste
// Entering paste mode (ctrl-D to finish)
val int: Int = 1
val long = 2L
val r = int << long
val r2 = int << 2L
val r3 = 1 << long
val r4 = 1 << 2L
val r5 = 1.toInt << long // right, a bit stupid but just to check it out
val r6 = 1.toInt << 2L
// Exiting paste mode, now interpreting.
int: Int = 1
long: Long = 2
r: Int = 4
r2: Int = 4
r3: Int = 4
r4: Long = 4
r5: Int = 4
r6: Int = 4
r4: The compiler changes this 1: Int to Long but why? Is it a bug?
Thanks,
Michal
You received this message because you are subscribed to the Google Groups "scala-language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-languag...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.