The scaladoc has all kinds of subtle bugs. The problem here is that you are seeing the "simplified" version of the method signature (meant as a way to convey the essential part of the signature and hide things such as CanBuildFrom
in map
/flatMap
methods, which are really an implementation detail).
The simplification got a little awry here, and does not seem to make much sense.
If you click on the "full signature" link, you'll see that the real signature looks like:
def toArray[B >: (A, B)](implicit arg0: ClassTag[B]): Array[B]
In fact this is still wrong, as we certainly cannot have a type B where B >: (A, B). It should be more like :
def toArray[C >: (A, B)](implicit arg0: ClassTag[C]): Array[C]
The problem is that there are actually two B
s: the first one comes from the HashMap
class declaration itself (HashMap[A, +B]
) while the other one comes from the methods toArray
defined in its base class
TraversableOnce
(def toArray[B >: A](implicit arg0: ClassTag[B]): Array[B]
). It just happens that the scaladoc generator failed to dedup the two instances of B