Skip to content

Commit 3189b11

Browse files
committed
Deprecate Float range and Double range
Ref scala/bug#10781 This is in preparation for Float range and Double range removal in 2.13.x (scala/scala#6468).
1 parent 98b4968 commit 3189b11

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

library/src/scala/collection/immutable/Range.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -497,9 +497,11 @@ object Range {
497497
implicit val doubleAsIntegral = scala.math.Numeric.DoubleAsIfIntegral
498498
def toBD(x: Double): BigDecimal = scala.math.BigDecimal valueOf x
499499

500+
@deprecated("use Range.BigDecimal instead", "2.12.6")
500501
def apply(start: Double, end: Double, step: Double) =
501502
BigDecimal(toBD(start), toBD(end), toBD(step)) mapRange (_.doubleValue)
502503

504+
@deprecated("use Range.BigDecimal.inclusive instead", "2.12.6")
503505
def inclusive(start: Double, end: Double, step: Double) =
504506
BigDecimal.inclusive(toBD(start), toBD(end), toBD(step)) mapRange (_.doubleValue)
505507
}

library/src/scala/runtime/ScalaNumberProxy.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,10 @@ trait FractionalProxy[T] extends Any with ScalaNumberProxy[T] with RangedProxy[T
6464
type ResultWithoutStep = Range.Partial[T, NumericRange[T]]
6565

6666
def isWhole() = false
67-
def until(end: T): ResultWithoutStep = new Range.Partial(NumericRange(self, end, _))
68-
def until(end: T, step: T): NumericRange.Exclusive[T] = NumericRange(self, end, step)
69-
def to(end: T): ResultWithoutStep = new Range.Partial(NumericRange.inclusive(self, end, _))
70-
def to(end: T, step: T): NumericRange.Inclusive[T] = NumericRange.inclusive(self, end, step)
67+
@deprecated("use BigDecimal range instead", "2.12.6") def until(end: T): ResultWithoutStep = new Range.Partial(NumericRange(self, end, _))
68+
@deprecated("use BigDecimal range instead", "2.12.6") def until(end: T, step: T): NumericRange.Exclusive[T] = NumericRange(self, end, step)
69+
@deprecated("use BigDecimal range instead", "2.12.6") def to(end: T): ResultWithoutStep = new Range.Partial(NumericRange.inclusive(self, end, _))
70+
@deprecated("use BigDecimal range instead", "2.12.6") def to(end: T, step: T): NumericRange.Inclusive[T] = NumericRange.inclusive(self, end, step)
7171
}
7272

7373
trait OrderedProxy[T] extends Any with Ordered[T] with Typed[T] {

0 commit comments

Comments
 (0)