Skip to content

Commit 942f77f

Browse files
authored
Merge pull request scala/scala#10369 from som-snytt/forward/int-div
Lint for integral divisions that are widened to a float [forward port from 2.12]
2 parents 482cfe0 + dbc8a27 commit 942f77f

File tree

3 files changed

+3
-0
lines changed

3 files changed

+3
-0
lines changed

library/src/scala/math/BigInt.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,7 @@ final class BigInt private (private var _bigInteger: BigInteger, private val _lo
278278
(shifted.signum != 0) && !(shifted equals BigInt.minusOne)
279279
}
280280

281+
@deprecated("isWhole on an integer type is always true", "2.12.15")
281282
def isWhole: Boolean = true
282283
def underlying: BigInteger = bigInteger
283284

library/src/scala/runtime/RichInt.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ final class RichInt(val self: Int) extends AnyVal with ScalaNumberProxy[Int] wit
3131
/** Returns `'''true'''` if this number has no decimal component.
3232
* Always `'''true'''` for `RichInt`.
3333
*/
34+
@deprecated("isWhole on an integer type is always true", "2.12.15")
3435
def isWhole = true
3536

3637
override def isValidInt = true

library/src/scala/runtime/ScalaNumberProxy.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ trait ScalaNumberProxy[T] extends Any with ScalaNumericAnyConversions with Typed
5050
@deprecated("use `sign` method instead", since = "2.13.0") def signum: Int = num.signum(self)
5151
}
5252
trait ScalaWholeNumberProxy[T] extends Any with ScalaNumberProxy[T] {
53+
@deprecated("isWhole on an integer type is always true", "2.12.15")
5354
def isWhole = true
5455
}
5556
trait IntegralProxy[T] extends Any with ScalaWholeNumberProxy[T] with RangedProxy[T] {

0 commit comments

Comments
 (0)