summaryrefslogtreecommitdiff
path: root/src/library/scala/collection/mutable/ArrayOps.scala
diff options
context:
space:
mode:
Diffstat (limited to 'src/library/scala/collection/mutable/ArrayOps.scala')
-rw-r--r--src/library/scala/collection/mutable/ArrayOps.scala19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/library/scala/collection/mutable/ArrayOps.scala b/src/library/scala/collection/mutable/ArrayOps.scala
index e342e134b4..00491ef20e 100644
--- a/src/library/scala/collection/mutable/ArrayOps.scala
+++ b/src/library/scala/collection/mutable/ArrayOps.scala
@@ -114,10 +114,16 @@ trait ArrayOps[T] extends Any with ArrayLike[T, Array[T]] with CustomParalleliza
* @tparam T2 the type of the second half of the element pairs
* @param asPair an implicit conversion which asserts that the element type
* of this Array is a pair.
+ * @param ct1 a class tag for T1 type parameter that is required to create an instance
+ * of Array[T1]
+ * @param ct2 a class tag for T2 type parameter that is required to create an instance
+ * of Array[T2]
* @return a pair of Arrays, containing, respectively, the first and second half
* of each element pair of this Array.
*/
- def unzip[T1: ClassTag, T2: ClassTag](implicit asPair: T => (T1, T2)): (Array[T1], Array[T2]) = {
+ // implementation NOTE: ct1 and ct2 can't be written as context bounds because desugared
+ // implicits are put in front of asPair parameter that is supposed to guide type inference
+ def unzip[T1, T2](implicit asPair: T => (T1, T2), ct1: ClassTag[T1], ct2: ClassTag[T2]): (Array[T1], Array[T2]) = {
val a1 = new Array[T1](length)
val a2 = new Array[T2](length)
var i = 0
@@ -137,10 +143,19 @@ trait ArrayOps[T] extends Any with ArrayLike[T, Array[T]] with CustomParalleliza
* @tparam T3 the type of the third of three elements in the triple
* @param asTriple an implicit conversion which asserts that the element type
* of this Array is a triple.
+ * @param ct1 a class tag for T1 type parameter that is required to create an instance
+ * of Array[T1]
+ * @param ct2 a class tag for T2 type parameter that is required to create an instance
+ * of Array[T2]
+ * @param ct3 a class tag for T3 type parameter that is required to create an instance
+ * of Array[T3]
* @return a triple of Arrays, containing, respectively, the first, second, and third
* elements from each element triple of this Array.
*/
- def unzip3[T1: ClassTag, T2: ClassTag, T3: ClassTag](implicit asTriple: T => (T1, T2, T3)): (Array[T1], Array[T2], Array[T3]) = {
+ // implementation NOTE: ct1, ct2, ct3 can't be written as context bounds because desugared
+ // implicits are put in front of asPair parameter that is supposed to guide type inference
+ def unzip3[T1, T2, T3](implicit asTriple: T => (T1, T2, T3), ct1: ClassTag[T1], ct2: ClassTag[T2],
+ ct3: ClassTag[T3]): (Array[T1], Array[T2], Array[T3]) = {
val a1 = new Array[T1](length)
val a2 = new Array[T2](length)
val a3 = new Array[T3](length)