New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Scala ApiDocs method signatures are inconsistent with method signatures in source #6046
Comments
Imported From: https://issues.scala-lang.org/browse/SI-6046?orig=1 |
@VladUreche said: def map[B, That](f: ((K, V)) ⇒ B)(implicit bf: CanBuildFrom[Map[K, V], B, That]): That and the usecase: def map[B, That](f: ((K, V)) ⇒ B): Map[B] // which is incorrect again, see SI-3448 What do you think? And now the long explanation why this signature gets there: trait TraversableLike[+A, +Repr] {
...
def map[B, That](f: A => B)(implicit bf: CanBuildFrom[Repr, B, That]): That = {
val b = bf(repr)
b.sizeHint(this)
for (x <- this) b += f(x)
b.result
}
...
} Now, map is inherited into scala.collection.Map by way of: trait Map[A, +B] extends Iterable[(A, B)] with ...
trait Iterable[+A] extends ... with IterableLike[A, Iterable[A]]
trait IterableLike[+A, +Repr] extends ... with TraversableLike[A, Repr] with ... But as you can see, def map[B, That](f: ((Map's)A, (Map's)B) => B)(implicit bf: CanBuildFrom[Repr, B, That]): That = ... |
@VladUreche said: |
@axel22 said: I don't think renaming the type parameters of |
@VladUreche said: |
@VladUreche said: |
@axel22 said (edited on Jul 11, 2012 12:11:39 PM UTC): |
@VladUreche said: |
For example, the method signature for Map[P,Q].map is:
class Map[P,Q]
def map[B, That](f: A => B)(implicit bf: CanBuildFrom[Repr, B, That]): That
...however, in the apidocs, the signature is given as:
def map[B, That](f: ((A, B)) ⇒ B)(implicit bf: CanBuildFrom[Map[A, B], B, That]): That
The first signature is the congruent with functioning code in 2.8.x and 2.9.x libraries. At first glance this problem seems to be inherent in the generation of the apidocs from the source.
The text was updated successfully, but these errors were encountered: