Skip to content

print deprecation warning for bitshift Int by a Long #2968

Closed
@smarter

Description

@smarter

The current situation is pretty bad:

2.11/Dotty:

scala> 1 << 33L
res0: Long = 8589934592

scala> val x = 1
x: Int = 1

scala> x << 33L
res1: Int = 0

2.12 (since scala/scala#4238):

scala> 1 << 33L
res0: Int = 2

scala> val x = 1
x: Int = 1

scala> x << 33L
res1: Int = 2

See also the discussion at https://gitter.im/scala/contributors?at=598b4b3eee5c9a4c5fa61568 where @Ichoran proposed getting rid of Int#<<(x: Long) since it can be so easily misused.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions