Bad return type for [Use Case] docs in Range #5678
fabien sartor (fasar) said:
# scala -version Scala code runner version 2.9.2 -- Copyright 2002-2011, LAMP/EPFL
In scala API doc at Range page there is an use case of union (http://www.scala-lang.org/api/current/scala/collection/immutable/Range.html)
def union(that: Seq[Int]): Range[A]
Then when I use union, Range union produces IndexedSeq.
scala> Range(1,5).union(Range(4,8)) res0: scala.collection.immutable.IndexedSeq[Int] = Vector(1, 2, 3, 4, 4, 5, 6, 7) Range(1,5).union(Seq(4,3,2)) res1: scala.collection.immutable.IndexedSeq[Int] = Vector(1, 2, 3, 4, 4, 3, 2)
The doc explains :
def union[B >: Int, That](that: GenSeq[B])(implicit bf: CanBuildFrom[IndexedSeq[Int], B, That]): That
But it's more difficult to read and possibly not corroborating with the usecase.
Anyway, I have looked into it, and verified that there's no CanBuildFrom that creates a Range. Furthermore, it seems
It's a very small change, but one does have to build the docs to look them over, and I'm a bit out of time these days. Maybe someone will come and pick this up, but this sort of ticket is very low priority. If you had more experience with Scala, I'd advise to look into submitting a pull request for it yourself. And if you have enough git, github and ant experience, you should try it -- just remove the line where