diff options
author | Sébastien Doeraene <sjrdoeraene@gmail.com> | 2016-05-28 09:23:05 +0200 |
---|---|---|
committer | Sébastien Doeraene <sjrdoeraene@gmail.com> | 2016-05-31 10:51:14 +0200 |
commit | 4c2f6f3cb1e0eee11facae8c44e3cd7db11378f1 (patch) | |
tree | f7ead878248da493a9495f469ec0be433eaedaa6 | |
parent | 8f567bc9c01e29624f5b7fcce40a0ee7fe261c08 (diff) | |
download | scala-4c2f6f3cb1e0eee11facae8c44e3cd7db11378f1.tar.gz scala-4c2f6f3cb1e0eee11facae8c44e3cd7db11378f1.tar.bz2 scala-4c2f6f3cb1e0eee11facae8c44e3cd7db11378f1.zip |
Privatize the deprecated members of `immutable.Range`.
The implementation of these obscure members of `Range` are
uselessly complicated for the purposes of `Range` itself.
Making them private will allow to relax their semantics to the
specific needs of `Range`, making them simpler, together with
the initialization code of `Range`.
`terminalElement` becomes dead code and is removed.
-rw-r--r-- | src/library/scala/collection/immutable/Range.scala | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/src/library/scala/collection/immutable/Range.scala b/src/library/scala/collection/immutable/Range.scala index 0c24d17c15..ca4f1f47a7 100644 --- a/src/library/scala/collection/immutable/Range.scala +++ b/src/library/scala/collection/immutable/Range.scala @@ -81,8 +81,7 @@ extends scala.collection.AbstractSeq[Int] || (start == end && !isInclusive) ) - @deprecated("this method will be made private, use `length` instead", "2.11.0") - final val numRangeElements: Int = { + private val numRangeElements: Int = { if (step == 0) throw new IllegalArgumentException("step cannot be 0.") else if (isEmpty) 0 else { @@ -92,8 +91,7 @@ extends scala.collection.AbstractSeq[Int] } } - @deprecated("this method will be made private, use `last` instead", "2.11.0") - final val lastElement = + private val lastElement = if (isEmpty) start - step else step match { case 1 => if (isInclusive) end else end-1 @@ -105,9 +103,6 @@ extends scala.collection.AbstractSeq[Int] else end - step } - @deprecated("this method will be made private", "2.11.0") - final val terminalElement = lastElement + step - /** The last element of this range. This method will return the correct value * even if there are too many elements to iterate over. */ |